Changeset: ffa569258bad for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ffa569258bad Modified Files: MonetDB5/src/modules/mal/pcre.mx Branch: Jun2010 Log Message:
Include some defenses against null pointers diffs (45 lines): diff -r a9e001c2fc92 -r ffa569258bad MonetDB5/src/modules/mal/pcre.mx --- a/MonetDB5/src/modules/mal/pcre.mx Sun Aug 15 18:52:27 2010 +0200 +++ b/MonetDB5/src/modules/mal/pcre.mx Sun Aug 15 19:34:58 2010 +0200 @@ -606,7 +606,7 @@ if (flags[i] == 'e') { exec_options -= PCRE_NOTEMPTY; /* - stream_printf(GDKout, "exec_options %d, PCRE_NOTEMPTY %d\n", + mnstr_printf(GDKout, "exec_options %d, PCRE_NOTEMPTY %d\n", exec_options, PCRE_NOTEMPTY); */ } else if (flags[i] == 'i') { @@ -975,10 +975,13 @@ { int escaped = 0; int hasWildcard = 0; - char *ppat = GDKmalloc(strlen(pat)*2+3 /* 3 = "^'the translated regexp'$0" */); + char *ppat; int esc = esc_str[0]; /* should change to utf8_convert() */ int specials = 0; + if (pat == NULL ) + return GDK_FAIL; + ppat = GDKmalloc(strlen(pat)*2+3 /* 3 = "^'the translated regexp'$0" */); if (ppat == NULL) return GDK_FAIL; @@ -1492,6 +1495,8 @@ if (*s++ != '%') return 0; #endif + if (s == 0) + return 0; if (*s == '%') s++; while(*s) { @@ -1535,7 +1540,7 @@ r = PCREsql2pcre(&ppat, pat, esc); - if (!r) { + if (!r && ppat) { if (strcmp(ppat, (char*)str_nil) == 0) { /* there is no pattern or escape involved, fall back to * simple (no PCRE) match */ _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list