Changeset: 70e8dbbf4f58 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/70e8dbbf4f58
Modified Files:
gdk/gdk_bbp.c
Branch: Sep2022
Log Message:
Fix some issues with BAT options (which aren't used anywhere).
diffs (48 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -660,14 +660,16 @@ BBPreadBBPline(FILE *fp, unsigned bbpver
return 0; /* end of file */
}
(*lineno)++;
- if ((s = strchr(buf, '\r')) != NULL) {
- /* convert \r\n into just \n */
- if (s[1] != '\n') {
+ if ((s = strpbrk(buf, "\r\n")) != NULL) {
+ if (s[0] == '\r' && s[1] != '\n') {
TRC_CRITICAL(GDK, "invalid format for BBP.dir on line
%d", *lineno);
return -1;
}
- *s++ = '\n';
- *s = 0;
+ /* zap the newline */
+ *s = '\0';
+ } else {
+ TRC_CRITICAL(GDK, "invalid format for BBP.dir on line %d: line
too long\n", *lineno);
+ return -1;
}
if (bbpversion <= GDKLIBRARY_HSIZE ?
@@ -744,7 +746,7 @@ BBPreadBBPline(FILE *fp, unsigned bbpver
}
nread += n;
- if (nread >= (int) sizeof(buf) || (buf[nread] != '\n' && buf[nread] !=
' ')) {
+ if (nread >= (int) sizeof(buf) || (buf[nread] != '\0' && buf[nread] !=
' ')) {
TRC_CRITICAL(GDK, "invalid format for BBP.dir on line %d",
*lineno);
return -1;
}
@@ -1995,8 +1997,13 @@ new_bbpentry(FILE *fp, bat i, BUN size,
assert(BBPfarms[bi->vh->farmid].roles & (1U << PERSISTENT));
}
assert(size <= bi->count || size == BUN_NONE);
+ assert(BBP_options(i) == NULL || strpbrk(BBP_options(i), "\r\n") ==
NULL);
#endif
+ if (BBP_options(i) != NULL && strpbrk(BBP_options(i), "\r\n") != NULL) {
+ GDKerror("options for bat %d contains a newline\n", i);
+ return GDK_FAIL;
+ }
if (size > bi->count)
size = bi->count;
if (fprintf(fp, "%d %u %s %s %d " BUNFMT " " OIDFMT,
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]