diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-07-27 10:55:38 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-07-27 10:55:38 -0300 |
commit | 4053eae9ebbf14963a388ba864454f9e4ec16663 (patch) | |
tree | 9100d693e015231e41f93a7ef2c8506d12cfafe1 | |
parent | 6d998055c80a0fe8d4698ba02becb1813203eee9 (diff) | |
download | lua-4053eae9ebbf14963a388ba864454f9e4ec16663.tar.gz lua-4053eae9ebbf14963a388ba864454f9e4ec16663.tar.bz2 lua-4053eae9ebbf14963a388ba864454f9e4ec16663.zip |
bug: Lua does not check GC when creating error messages
-rw-r--r-- | bugs | 63 |
1 files changed, 54 insertions, 9 deletions
@@ -2899,6 +2899,30 @@ patch = [[ | |||
2899 | ]] | 2899 | ]] |
2900 | } | 2900 | } |
2901 | 2901 | ||
2902 | Bug{ | ||
2903 | what = [[Lua does not check memory use when creating error messages]], | ||
2904 | report = [[John Dunn, 2012/09/24]], | ||
2905 | since = [[5.2.0]], | ||
2906 | fix = nil, | ||
2907 | example = [[ | ||
2908 | local code = "function test()\n bob.joe.larry = 23\n end" | ||
2909 | |||
2910 | load(code)() | ||
2911 | |||
2912 | -- memory will grow steadly | ||
2913 | for i = 1, math.huge do | ||
2914 | pcall(test) | ||
2915 | if i % 100000 == 0 then | ||
2916 | io.write(collectgarbage'count'*1024, "\n") | ||
2917 | end | ||
2918 | end | ||
2919 | ]], | ||
2920 | patch = [[ | ||
2921 | ]] | ||
2922 | } | ||
2923 | |||
2924 | |||
2925 | |||
2902 | 2926 | ||
2903 | 2927 | ||
2904 | ----------------------------------------------------------------- | 2928 | ----------------------------------------------------------------- |
@@ -3656,9 +3680,9 @@ It needs an "interceptor" 'memcmp' function that continues | |||
3656 | reading memory after a difference is found.]], | 3680 | reading memory after a difference is found.]], |
3657 | patch = [[ | 3681 | patch = [[ |
3658 | 2c2 | 3682 | 2c2 |
3659 | < ** $Id: bugs,v 1.153 2017/05/19 12:58:40 roberto Exp roberto $ | 3683 | < ** $Id: bugs,v 1.154 2017/05/22 12:55:16 roberto Exp roberto $ |
3660 | --- | 3684 | --- |
3661 | > ** $Id: bugs,v 1.153 2017/05/19 12:58:40 roberto Exp roberto $ | 3685 | > ** $Id: bugs,v 1.154 2017/05/22 12:55:16 roberto Exp roberto $ |
3662 | 263c263,264 | 3686 | 263c263,264 |
3663 | < for (option = LUA_STRFTIMEOPTIONS; *option != '\0'; option += oplen) { | 3687 | < for (option = LUA_STRFTIMEOPTIONS; *option != '\0'; option += oplen) { |
3664 | --- | 3688 | --- |
@@ -3780,18 +3804,39 @@ patch = [[ | |||
3780 | ]] | 3804 | ]] |
3781 | } | 3805 | } |
3782 | 3806 | ||
3783 | |||
3784 | --[=[ | ||
3785 | Bug{ | 3807 | Bug{ |
3786 | what = [[ ]], | 3808 | what = [[Lua does not check GC when creating error messages]], |
3787 | report = [[ ]], | 3809 | report = [[Viacheslav Usov, 2017/07/06]], |
3788 | since = [[ ]], | 3810 | since = [[5.3.2]], |
3789 | fix = nil, | 3811 | fix = nil, |
3790 | example = [[ ]], | 3812 | example = [[ |
3813 | function test() | ||
3814 | bob.joe.larry = 23 | ||
3815 | end | ||
3816 | |||
3817 | -- memory will grow steadly | ||
3818 | for i = 1, math.huge do | ||
3819 | pcall(test) | ||
3820 | if i % 100000 == 0 then | ||
3821 | io.write(collectgarbage'count'*1024, "\n") | ||
3822 | end | ||
3823 | end | ||
3824 | ]], | ||
3791 | patch = [[ | 3825 | patch = [[ |
3826 | --- ldebug.c 2017/04/19 17:20:42 2.121.1.1 | ||
3827 | +++ ldebug.c 2017/07/10 17:08:39 | ||
3828 | @@ -653,6 +653,7 @@ | ||
3829 | CallInfo *ci = L->ci; | ||
3830 | const char *msg; | ||
3831 | va_list argp; | ||
3832 | + luaC_checkGC(L); /* error message uses memory */ | ||
3833 | va_start(argp, fmt); | ||
3834 | msg = luaO_pushvfstring(L, fmt, argp); /* format message */ | ||
3835 | va_end(argp); | ||
3792 | ]] | 3836 | ]] |
3793 | } | 3837 | } |
3794 | ]=] | 3838 | |
3839 | |||
3795 | 3840 | ||
3796 | 3841 | ||
3797 | --[=[ | 3842 | --[=[ |