Changeset 22935

Show
Ignore:
Timestamp:
21.09.2010 18:45:30 (9 years ago)
Author:
ak19
Message:

For ticket no 712. Fixes to 2 related crashes that occurred when using a combination of advanced (server.exe and library.cgi depending on which web server was used): 1. When parsing cgi args, arrays stem and fold contained the URL encodings percent-2-C rather than commas for delimiters and weren't split properly resulting in arrays of unexpected lengths (and values). Need to decode the percent-2-C to commas by calling decode_commas() in cgiutils.cpp before splitting. 2. decode_commas in cgiutils.cpp was performing an illegal iterator operation by attempting to peek PAST the end of the iterator which doesn't seem to be allowed by the STL code. When the iteration really got past the end, the iteration operation causes a problem resulting in a server.exe crash of its own.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/querytools.cpp

    r22046 r22935  
    2626#include "querytools.h" 
    2727#include <ctype.h> 
     28#include "cgiutils.h" 
    2829#include "unitool.h" // for is_unicode_letdig 
    2930 
     
    663664    text_t stem = args["fqs"]; 
    664665    if (stem.empty()) return; // somethings wrong 
     666    stem = decode_commas(stem); // %2C -> , 
    665667    splitchar(stem.begin(), stem.end(), ',', stems); 
    666668     
    667669    text_t fold = args["fqk"]; 
    668670    if (fold.empty()) return; // somethings wrong 
     671    fold = decode_commas(fold); // %2C -> , 
    669672    splitchar(fold.begin(), fold.end(), ',', folds); 
    670673  }