lua-users home
lua-l archive

Quiteing clang static analyzer

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


I’m using lua 5.3 in a project and clang static analyzer (scan-build) complained about a potential NULL pointer deference in OS lib (loslib.c). The analyzer doesn’t know luaL_error uses setjmp/longjmp and it has its full right to complain. The os_date C function contains this code:
stm = l_gmtime(&t, &tmr);
~~~ snip ~~~
 if (stm == NULL) /* invalid date? */
 luaL_error(L, "time result cannot be represented in this installation”);
~~~ snip ~~~
problem “passing NULL pointer” -> setallfields(L, stm);
A simple solution would be just doing a return luaL_error which silences this false-positive.
Kind regards,
Jerry Jacobs

AltStyle によって変換されたページ (->オリジナル) /