[CRIU] [PATCHv2] x86/crtools: Fix null pointer dereference

Dmitry Safonov 0x7f454c46 at gmail.com
Thu May 2 19:14:46 MSK 2019


On Thu, 2 May 2019 at 15:54, Radostin Stoyanov <rstoyanov1 at gmail.com> wrote:
>
> 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.

No worries - I don't usually nack anything and don't like to do it,
hopefully, my reply wasn't harsh.

Thanks,
             Dmitry


More information about the CRIU mailing list