Fossil

Check-in [20adff9572]
Login

Check-in [20adff9572]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Revert two small sections of [4c3e1728e1b1a9cb] for cases which are not compatible with fsl_strdup()'s passing-on of NULL values. Found while investigating a presumably unrelated crash.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 20adff9572f49fa51c22e294a78315249258aeeb25012cb7a9984763f40e00e9
User & Date: stephan 2025-10-21 13:49:32.776
Context
2025-10-21
14:38
Add (open --reopen REPOFILE), based on a /chat discussion with Martin G., Brickviking, and Richard, and prompted by [forum:bac6213f6e59f1f9|forum post bac6213f6e59f1f9]. This simply forwards that usage to the test-move-repository command. ... (check-in: ae8a45c7a7 user: stephan tags: trunk)
13:49
Revert two small sections of [4c3e1728e1b1a9cb] for cases which are not compatible with fsl_strdup()'s passing-on of NULL values. Found while investigating a presumably unrelated crash. ... (check-in: 20adff9572 user: stephan tags: trunk)
13:06
Remove a bogus assert which could trigger on an anonymous clone. ... (check-in: ecf44a280d user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/search.c.
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
  if( fSrchFlg & SRCHFLG_STATIC ){
    p = &gSearch;
    search_end(p);
  }else{
    p = fossil_malloc(sizeof(*p));
    memset(p, 0, sizeof(*p));
  }
  p->zPattern = z = fossil_strdup(zPattern);
  p->zMarkBegin = fossil_strdup(zMarkBegin);
  p->zMarkEnd = fossil_strdup(zMarkEnd);
  p->zMarkGap = fossil_strdup(zMarkGap);
  p->fSrchFlg = fSrchFlg;
  blob_init(&p->snip, 0, 0);
  while( *z && p->nTerm<SEARCH_MAX_TERM ){
    while( *z && !ISALNUM(*z) ){ z++; }
    if( *z==0 ) break;
    p->a[p->nTerm].z = z;
    for(i=1; ISALNUM(z[i]); i++){}







|
|
|
|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
  if( fSrchFlg & SRCHFLG_STATIC ){
    p = &gSearch;
    search_end(p);
  }else{
    p = fossil_malloc(sizeof(*p));
    memset(p, 0, sizeof(*p));
  }
  p->zPattern = z = mprintf("%s",zPattern);
  p->zMarkBegin = mprintf("%s",zMarkBegin);
  p->zMarkEnd = mprintf("%s",zMarkEnd);
  p->zMarkGap = mprintf("%s",zMarkGap);
  p->fSrchFlg = fSrchFlg;
  blob_init(&p->snip, 0, 0);
  while( *z && p->nTerm<SEARCH_MAX_TERM ){
    while( *z && !ISALNUM(*z) ){ z++; }
    if( *z==0 ) break;
    p->a[p->nTerm].z = z;
    for(i=1; ISALNUM(z[i]); i++){}
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
** replaces all non-alphanum ASCII characters with a space, and
** lower-cases all upper-case ASCII characters. The intent is to avoid
** causing errors in FTS5 searches with inputs which contain AND, OR,
** and symbols like #. The caller is responsible for passing the
** result to fossil_free().
*/
char *search_simplify_pattern(const char * zPattern){
  char *zPat = fossil_strdup(zPattern);
  int i;
  for(i=0; zPat[i]; i++){
    if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' ';
    if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]);
  }
  for(i--; i>=0 && zPat[i]==' '; i--){}
  if( i<0 ){







|







1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
** replaces all non-alphanum ASCII characters with a space, and
** lower-cases all upper-case ASCII characters. The intent is to avoid
** causing errors in FTS5 searches with inputs which contain AND, OR,
** and symbols like #. The caller is responsible for passing the
** result to fossil_free().
*/
char *search_simplify_pattern(const char * zPattern){
  char *zPat = mprintf("%s",zPattern);
  int i;
  for(i=0; zPat[i]; i++){
    if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' ';
    if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]);
  }
  for(i--; i>=0 && zPat[i]==' '; i--){}
  if( i<0 ){