Skip to content

Commit

Permalink
opt: headword parse modification
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Jul 23, 2024
1 parent 1ff838c commit e8cb709
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dict/stardict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,11 @@ static void handleIdxSynFile( string const & fileName,
for ( char const * ptr = &image.front(); ptr != &image.back(); ) {
size_t wordLen = strlen( ptr );

if ( wordLen == 0 ) {
ptr++;
continue;
}

if ( ptr + wordLen + 1 + ( isSynFile ? sizeof( uint32_t ) : sizeof( uint32_t ) * 2 ) > &image.back() ) {
GD_FDPRINTF( stderr, "Warning: sudden end of file %s\n", fileName.c_str() );
break;
Expand Down

0 comments on commit e8cb709

Please sign in to comment.