#277 error() in preproc.c uses uninitialized istk


The error() function in preproc.c uses
the istk variable, to determine if an
error should be suppressed or not. The
variable has no default initializer; as
a result it remains uninitialized until
pp_reset() has been called.

However, the pp_pre_define() as well as
the pp_pre_undefine() function do call
the tokenise() function, which in turn
is capable of calling error() -- it may
e.g. see an unterminated string.

And because pp_pre_define() as well as
pp_pre_undefine() are called before the
pp_reset() function, something like...

nasm "-D'" foobar.asm

... is going to fail.

The result could be unexpected behavior,
a crash, silent corruption, etc.


  • nasm64developer

    nasm64developer - 2006-08-07

    Logged In: YES

    Note that having istk default to NULL is not
    sufficient to fix this problem.

    In addition, SF bug #1535686 need to be fixed.

  • Anonymous

    Anonymous - 2010-08-07

    Aforementioned issue with error() is no longer relevant in the preproc-rewrite branch, tentatively 2.10rc1.

  • Anonymous

    Anonymous - 2010-08-07
    • assigned_to: nobody --> kkanios
    • status: open --> closed-fixed

Log in to post a comment.