File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ void lua_registerUndumpHook ( lua_UndumpHook f )
2727 pUndumpHook = f ;
2828}
2929
30+ // precompiled chunk for MTA always uses 4 byte size_t
31+ #define SIZE_T_PRECOMPILED_CHUNK 4
32+
3033typedef struct {
3134 lua_State * L ;
3235 ZIO * Z ;
@@ -82,8 +85,12 @@ static lua_Number LoadNumber(LoadState* S)
8285
8386static TString * LoadString (LoadState * S )
8487{
85- size_t size ;
86- LoadVar (S ,size );
88+ size_t size = 0 ;
89+ if ( sizeof (size_t ) <= SIZE_T_PRECOMPILED_CHUNK )
90+ LoadVar (S ,size );
91+ else
92+ LoadMem (S ,& size ,1 ,SIZE_T_PRECOMPILED_CHUNK );
93+
8794 if (size == 0 )
8895 return NULL ;
8996 else
@@ -192,6 +199,8 @@ static void LoadHeader(LoadState* S)
192199 char h [LUAC_HEADERSIZE ];
193200 char s [LUAC_HEADERSIZE ];
194201 luaU_header (h );
202+ if ( h [8 ] > SIZE_T_PRECOMPILED_CHUNK )
203+ h [8 ] = SIZE_T_PRECOMPILED_CHUNK ;
195204 LoadBlock (S ,s ,LUAC_HEADERSIZE );
196205 IF (memcmp (h ,s ,LUAC_HEADERSIZE )!= 0 , "bad header" );
197206}
You can’t perform that action at this time.
0 commit comments