Menu

#77 NDISASM core dumps

open-works-for-me
nobody
None
1
2004-02-15
2003-01-29
Anonymous
No

Both NASM and NDISASM use the readnum() function
in nasmlib.c. This function converts the string
argument into a 32-bit number, and generates the
suppressible number-overflow warning whenever a
number doesn't fit into 32 bits.

To emit the warning, the readnum() code relies
on nasm_malloc_error, which is expected to point
to the error handling routine.

This works for NASM, as it properly initializes
nasm_malloc_error.

However, it doesn't work for NDISASM, since it
neither initializes nasm_malloc_error, nor has a
suitable error handling routine, like nasm.c's
report_error().

As a result NDISASM core dumps whenever a call
to readnum triggers the warning.

For example:

C:\TEMP\nasm_0_98_35>ndisasm -o 123456789h
0 [main] ndisasm 1000 handle_exceptions:
Exception: STATUS_ACCESS_VIOLATION
17248 [main] ndisasm 1000 stackdump: Dumping stack
trace to ndisasm.exe.stackdump

It looks like this problem is a result of a hack
since said number-overflow warning was "glued on"
in v0.96, but whoever added it didn't want to
hand an efunc to readnum(). Or knew that he/she
couldn't hand an efunc to it for NDISASM.

In other words: handing an efunc to readnum()
would be the correct thing to do for NASM, but
it would not work for NDISASM, due to the lack
of a suitable efunc.

I'd like us to discuss potential solutions before
anyone rushes towards trying to fix this one by
introducing yet another sloppy hack.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    My suggestion is to add a NASM-like efunc for NDISASM.
    It doesn't have to be as powerful as report_error().

     
  • nasm64developer

    nasm64developer - 2004-02-15
    • priority: 5 --> 1
    • status: open --> open-works-for-me
     
  • nasm64developer

    nasm64developer - 2004-12-28

    Logged In: YES
    user_id=804543

    SF bug #1091705 is a duplicate of this one.

    It includes a proposed fix that looks suitable.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.