[CRIU] [PATCHv2] x86/crtools: Fix null pointer dereference
Radostin Stoyanov
rstoyanov1 at gmail.com
Thu May 2 17:53:59 MSK 2019
On 02/05/2019 14:12, Dmitry Safonov wrote:
> On 5/2/19 10:36 AM, Radostin Stoyanov wrote:
>> Dereferencing a null pointer is undefined behavior.
>>
>> ISO/IEC 9899, clause 6.5.3.2, paragraph 4
>> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
> That doesn't make sense, sorry.
>
> sizeof() operator doesn't evaluate expression as long as it's not a
> var-array (which is not the case), check in the paper 6.5.3.4:
> "If the type of the operand is a variable length array type, the operand
> is evaluated; otherwise, the operand is not evaluated and the result is
> an integer constant."
>
> Basically, in this case it's a compile-time constant.
> I.e.:
> sizeof(valid_xsave_frame(NULL)) will be the same as sizeof(bool),
> without actual runtime function call.
This is good to know, thank you for pointing it out.
Radostin
More information about the CRIU
mailing list