Re: [CLucene-dev] Potential bug in SegmentTermEnum.cpp

2011-02-08 Thread Itamar Syn-Hershko
I understand perfectly well. I was merely pointing two facts: 1. If malloc/realloc fails, it is not enough to ignore the fact that buffer == NULL. The indexing process has to be aborted in some way. Meaning, your added if statement should have an else clause, probably with an exception thrown

Re: [CLucene-dev] Potential bug in SegmentTermEnum.cpp

2011-02-08 Thread Rustem Alimov
Hi, you don't understand... If buffer == NULL, then _tcsncpy(buffer,_term->text(), bufferLength); - at this point we have potential bug Need [code] //Instantiate the new buffer + 1 is needed for terminator '\0' if ( buffer == NULL ) buffer = (TCHAR*)malloc(sizeof(TC

Re: [CLucene-dev] Potential bug in SegmentTermEnum.cpp

2011-01-27 Thread Itamar Syn-Hershko
Hi, If malloc / realloc returns NULL the indexing process has to be aborted anyway, and the only way I can think of doing this is throwing an exception. Did you have other idea in mind? Also, I'm not sure why growBuffer is used there at all. This is a simple TCHAR array being used as a buf

[CLucene-dev] Potential bug in SegmentTermEnum.cpp

2010-10-22 Thread Rustem Alimov
Hi, src/core/CLucene/index/SegmentTermEnum.cpp : line 377 [code] //Instantiate the new buffer + 1 is needed for terminator '\0' if ( buffer == NULL ) buffer = (TCHAR*)malloc(sizeof(TCHAR) * (bufferLength+1)); else buffer = (TCHAR*)realloc(buffer, si