| 91 | |
| 92 | |
| 93 | static TString *LoadString(LoadState *S) { |
| 94 | size_t size = LoadByte(S); |
| 95 | if (size == 0xFF) |
| 96 | LoadVar(S, size); |
| 97 | if (size == 0) |
| 98 | return nullptr; |
| 99 | else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ |
| 100 | char buff[LUAI_MAXSHORTLEN]; |
| 101 | LoadVector(S, buff, size); |
| 102 | return luaS_newlstr(S->L, buff, size); |
| 103 | } |
| 104 | else { /* long string */ |
| 105 | TString *ts = luaS_createlngstrobj(S->L, size); |
| 106 | LoadVector(S, getstr(ts), size); /* load directly in final place */ |
| 107 | return ts; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // 500M |
| 112 | const int g_sizelimit = 1024 * 1024 * 500; |
no test coverage detected