Repository for the aotus library is now located at https://github.com/apes-suite/aotus
修訂 | a31931ecf1d2b4a583edd402abd79eb85479a2b0 (tree) |
---|---|
時間 | 2022-08-31 16:20:35 |
作者 | Harald Klimach <harald.klimach@dlr....> |
Commiter | Harald Klimach |
Applied patch 4 for Lua 5.4.4.
https://github.com/lua/lua/commit/42d40581dd919fb134c07027ca1ce0844c670daf
@@ -824,8 +824,11 @@ | ||
824 | 824 | va_start(argp, fmt); |
825 | 825 | msg = luaO_pushvfstring(L, fmt, argp); /* format message */ |
826 | 826 | va_end(argp); |
827 | - if (isLua(ci)) /* if Lua function, add source:line information */ | |
827 | + if (isLua(ci)) { /* if Lua function, add source:line information */ | |
828 | 828 | luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci)); |
829 | + setobjs2s(L, L->top - 2, L->top - 1); /* remove 'msg' from the stack */ | |
830 | + L->top--; | |
831 | + } | |
829 | 832 | luaG_errormsg(L); |
830 | 833 | } |
831 | 834 |
@@ -656,8 +656,10 @@ | ||
656 | 656 | /* collect total length and number of strings */ |
657 | 657 | for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) { |
658 | 658 | size_t l = vslen(s2v(top - n - 1)); |
659 | - if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl)) | |
659 | + if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl)) { | |
660 | + L->top = top - total; /* pop strings to avoid wasting stack */ | |
660 | 661 | luaG_runerror(L, "string length overflow"); |
662 | + } | |
661 | 663 | tl += l; |
662 | 664 | } |
663 | 665 | if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */ |
@@ -672,7 +674,7 @@ | ||
672 | 674 | setsvalue2s(L, top - n, ts); /* create result */ |
673 | 675 | } |
674 | 676 | total -= n-1; /* got 'n' strings to create 1 new */ |
675 | - L->top -= n-1; /* popped 'n' strings and pushed one */ | |
677 | + L->top = top - (n - 1); /* popped 'n' strings and pushed one */ | |
676 | 678 | } while (total > 1); /* repeat until only 1 result left */ |
677 | 679 | } |
678 | 680 |