GNU bug report logs -
#8254
race condition in dired.c's scmp function
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Tue, 15 Mar 2011 06:17:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 8254 <at> debbugs.gnu.org (full text, mbox):
> Date: Mon, 14 Mar 2011 23:16:26 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Cc:
>
> The following code in the Emacs trunk src/dired.c's scmp function has
> undefined behavior:
>
> while (l
> && (DOWNCASE ((unsigned char) *s1++)
> == DOWNCASE ((unsigned char) *s2++)))
> l--;
>
> Because the DOWNCASE macro assigns to the global variables case_temp1
> and case_temp2, (DOWNCASE (x) == DOWNCASE (y)) is not valid, as the
> assignments can collide and lead to a race condition.
> [...]
> I plan to work around the problem with something like the following
> patch.
Whew! How about a much simpler fix:
while (l
&& (c1 = DOWNCASE ((unsigned char) *s1++),
c2 = DOWNCASE ((unsigned char) *s2++),
c1 == c2))
l--;
(with suitable declarations of c1 and c2)? Will that fix the
undefined behavior?
This bug report was last modified 14 years and 72 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.