lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm using VS2010 Static Analyzer to find problematic spots, and there are couple, but I'm not sure whether they are real problems.

In any case here they are (I've also defined _CRT_DISABLE_WARNINGS, otherwise MSVC was complaining too much).

There is only one I think might cause a crash, but it's not in the lua, luac (it was spotted by one of the warnings below)

This code here:
   output=argv[++i];
   if (output==NULL || *output==0 || (*output=='-' && output[1]!=0))
    usage(LUA_QL("-o") " needs argument");
   if (IS("-")) output=NULL;

Here output=argv[++i] might not be NULL, and still be invalid pointer (Actually I'm not totally sure about it. It could be that the ANSI C standard is saying something that if there is main(int argc, const char* argv[]), then argv[argc] must be NULL, but I can't tell).


Here are the rest of the static analyzer warnings:


lua-5.2.0\src\llex.c(475): warning C6385: Invalid data: accessing 'luai_ctype_', the readable size is '257' bytes, but '1012' bytes might be read: Lines: 388, 390, 395, 396, 390, 395, 396, 390, 395, 396, 390, 474, 475

lua-5.2.0\src\liolib.c(436): warning C6011: Dereferencing NULL pointer 'p': Lines: 416, 417, 418, 419, 420, 425, 426, 427, 428, 433, 434, 435, 436

lua-5.2.0\src\ldebug.c(366): warning C6385: Invalid data: accessing 'luaP_opmodes', the readable size is '40' bytes, but '1005' bytes might be read: Lines: 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 333, 334, 335, 336, 337, 365, 366

lua-5.2.0\src\lundump.c(196): warning C6385: Invalid data: accessing 'argument 2', the readable size is 'sizeof(char)' bytes, but '18' bytes might be read: Lines: 191, 192, 193, 194, 195, 196

lua-5.2.0\src\luac.c(93): warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'strcmp': Lines: 71, 72, 73, 74, 76, 78, 84, 86, 88, 95, 97, 99, 102, 74, 76, 78, 84, 86, 88, 90, 91, 92, 93

lua-5.2.0\src\luac.c(183): warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'ferror': Lines: 164, 165, 166, 167, 168, 169, 174, 175, 176, 178, 179, 180, 181, 182, 183

lua-5.2.0\src\luac.c(184): warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'fclose': Lines: 164, 165, 166, 167, 168, 169, 174, 175, 176, 178, 179, 180, 181, 182, 183, 184

lua-5.2.0\src\lstrlib.c(362): warning C6386: Buffer overrun: accessing 'ms->capture', the writable size is '256' bytes, but '264' bytes might be written: Lines: 359, 360, 361, 362

lua-5.2.0\src\lstrlib.c(502): warning C6385: Invalid data: accessing 'ms->capture', the readable size is '256' bytes, but '8388488' bytes might be read: Lines: 495, 502

lua-5.2.0\src\lparser.c(1058): warning C6385: Invalid data: accessing 'priority', the readable size is '30' bytes, but '36' bytes might be read: Lines: 1045, 1046, 1047, 1048, 1049, 1055, 1057, 1058




On 11/29/2011 4:34 PM, Luiz Henrique de Figueiredo wrote:
Lua 5.2.0 (rc3) is now available at
	http://www.lua.org/work/lua-5.2.0-rc3.tar.gz

MD5	e46a6b1fb4ec761c14a5429bba77a2c5  -
SHA1	8072d2e09c2ff1c88d3a87faf30f468a9ad51ea6  -

The main changes in Lua 5.2 are listed in
	http://www.lua.org/work/doc/#changes

The complete diffs from rc2 to rc3 are available at
	http://www.lua.org/work/diffs-lua-5.2.0-rc2-rc3.txt

A test suite is available at
	http://www.lua.org/tests/5.2/

This release candidate will be the final version of Lua 5.2.0 if
no glitches are found in the next 10 days or so.

We thank everyone for their feedback on Lua 5.2.0 till now.

All feedback welcome. Thanks.
--lhf