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

closed-fixed
Keith Kanios
1
2010-08-07
2006-08-07
nasm64developer
No

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.

Discussion

  • Logged In: YES
    user_id=804543

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

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

     
  • Keith Kanios
    Keith Kanios
    2010-08-07

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

     
  • Keith Kanios
    Keith Kanios
    2010-08-07

    • assigned_to: nobody --> kkanios
    • status: open --> closed-fixed