From e8cb709029270dc2e5380f7335514c6e9d9e4871 Mon Sep 17 00:00:00 2001 From: Xiao Yi Fang Date: Tue, 23 Jul 2024 15:16:42 +0800 Subject: [PATCH] opt: headword parse modification --- src/dict/stardict.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dict/stardict.cc b/src/dict/stardict.cc index a9d9be7b..697e24b9 100644 --- a/src/dict/stardict.cc +++ b/src/dict/stardict.cc @@ -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;