NASM core dumps when it encounters a label name
that consists of more than 4,095 characters. The
culprit is PERMTS_SIZE in labels.c.
The solution is to perform a strlen(label) check
at the very beginning of find_label(), and emit
a fatal error if it exceeds PERMTS_SIZE-1.
Unfortunately this will require that an efunc is
handed to find_label(). Which in turn means the
efunc needs to be handed to lookup_label() and
is_extern(). (The other functions that make use
of find_label(), already get the efunc.)
One alternative would be to hand the efunc to
init_labels(), so that it can be stored inside
a variable that's local to labels.c. (This seems
to be the approach used by other modules which
use efunc a lot.)
Another alternative would be to stop handing the
efunc around everywhere, and instead introduce a
global variable that points to the efunc. (This
would allow us to throw errors anywhere.)
Check the expert's forum for a thread on this.
In any case the 4,095 character limit should be
documented in the NASM manual.
PS: I'll spare you a piece of sample code -- it's
really easy to type one of those lengthy labels.
Log in to post a comment.