zsh-workers
 help / color / mirror / code / Atom feed
* Bug in zsh 4.0.7
@ 2003-07-25  9:48 Chris Spiegel
  2003-07-25 10:00 ` Zefram
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Spiegel @ 2003-07-25  9:48 UTC (permalink / raw)
  To: zsh-workers

Hi,
  There is a bug in Src/math.c of zsh 4.0.7, line 382.  It is:

yyval.u.l = zstrtol(++ptr, &ptr, lastbase = 16);

The issue is that it's unspecified whether ++ptr or &ptr happens first.
Strictly speaking according to the C standard this results in undefined
behavior but in practice it means you may be taking the wrong address
(it may take the address of the pointer to 'X' or 'x', instead of the
address of the pointer one beyond 'X' or 'x').

The presumed fix would be:
ptr++;
yyval.u.l = zstrtol(ptr, &ptr, lastbase = 16);

References are C99 6.5p2 and C90 6.3p2.

Chris


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-07-25 10:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-25  9:48 Bug in zsh 4.0.7 Chris Spiegel
2003-07-25 10:00 ` Zefram
2003-07-25 10:10 ` Peter Stephenson
2003-07-25 10:19 ` Chris Spiegel

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).