Changeset 26294 for main

Show
Ignore:
Timestamp:
08.10.2012 18:53:33 (7 years ago)
Author:
ak19
Message:

Fix to server crashing bugs. Diego reported a bug when searching on partial numerical values like dates of the form 28-02-2012 (spotted in collections of simple html files). Search results are returned, but clicking a resulting document crashes the server. During testing, it turned out that an alphanumeric string that I tried also caused the same problem in another part of the same code (same cpp file), so I fixed it in multiple places: it was going past the array.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/common-src/indexers/mgpp/text/GSDLQueryLex.cpp

    r25526 r26294  
    5353  if (c == '+') { 
    5454    AddNChar (here, el.text, charLen); 
    55     charLen = parse_utf8_char (&*here, endMinus1, &c); 
     55    if(here != end) { 
     56        charLen = parse_utf8_char (&*here, endMinus1, &c); 
     57    } 
    5658  } else if (c == '-') { 
    5759    neg = true; 
    5860    AddNChar (here, el.text, charLen); 
    59     charLen = parse_utf8_char (&*here, endMinus1, &c); 
     61    if(here != end) {    
     62        charLen = parse_utf8_char (&*here, endMinus1, &c); 
     63    } 
    6064  } 
    6165 
     
    6872    el.num = el.num*10 + c - '0'; 
    6973    AddNChar (here, el.text, charLen); 
    70     charLen = parse_utf8_char (&*here, endMinus1, &c); 
     74    if(here == end) { 
     75        break; 
     76    } else { 
     77        charLen = parse_utf8_char (&*here, endMinus1, &c); 
     78    } 
    7179  } 
    7280 
     
    131139    AddNChar (here, el.text, charLen); 
    132140    length += charLen; 
    133     charLen = parse_utf8_char (&*here, endMinus1, &c); 
     141    if(here == end) {  
     142        break;  
     143    } else { 
     144        charLen = parse_utf8_char (&*here, endMinus1, &c); 
     145    } 
    134146  } 
    135147