From 1391a8fa7ee59cef80c68a001118bf46047f9b12 Mon Sep 17 00:00:00 2001 From: YiFang Xiao Date: Sat, 3 Jun 2023 09:36:18 +0800 Subject: [PATCH] fix: invalid data access of data field bgl_babylon.cc fix #770 --- src/dict/bgl_babylon.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dict/bgl_babylon.cc b/src/dict/bgl_babylon.cc index 86e14559..8e0d6c2b 100644 --- a/src/dict/bgl_babylon.cc +++ b/src/dict/bgl_babylon.cc @@ -382,9 +382,10 @@ bgl_entry Babylon::readEntry( ResourceHandler * resourceHandler ) len = qFromBigEndian( *reinterpret_cast< quint32 * >( block.data + pos ) ); pos += 4; } - else - { - len = (unsigned char)block.data[pos++]; + else { + if ( pos + 1 > block.length ) + break; + len = (unsigned char)block.data[ pos++ ]; } if( pos + len > block.length )