GNU bug report logs -
#8310
update-game-score -r logic broken with MAX_SCORES
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Mon, 21 Mar 2011 07:38:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8310 in the body.
You can then email your comments to 8310 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8310
; Package
emacs
.
(Mon, 21 Mar 2011 07:38:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 21 Mar 2011 07:38:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Here's a bug found by gcc -Wstrict-overflow (GCC 4.5.2) this one in
in update-game-score -r. I plan to install the following patch.
update-game-score: fix bug with -r
* update-game-score.c (main): Don't set 'scores' to garbage when
-r is specified and scorecount != MAX_SCORES. This bug was
introduced in the 2002-04-10 change, and was found with gcc
-Wstrict-overflow (GCC 4.5.2, x86-64).
=== modified file 'lib-src/update-game-score.c'
--- lib-src/update-game-score.c 2011-02-21 18:06:25 +0000
+++ lib-src/update-game-score.c 2011-03-21 07:17:22 +0000
@@ -242,13 +242,15 @@
push_score (&scores, &scorecount, newscore, user_id, newdata);
sort_scores (scores, scorecount, reverse);
/* Limit the number of scores. If we're using reverse sorting, then
- we should increment the beginning of the array, to skip over the
- *smallest* scores. Otherwise, we just decrement the number of
- scores, since the smallest will be at the end. */
+ also increment the beginning of the array, to skip over the
+ *smallest* scores. Otherwise, just decrementing the number of
+ scores suffices, since the smallest is at the end. */
if (scorecount > MAX_SCORES)
- scorecount -= (scorecount - MAX_SCORES);
- if (reverse)
- scores += (scorecount - MAX_SCORES);
+ {
+ if (reverse)
+ scores += (scorecount - MAX_SCORES);
+ scorecount = MAX_SCORES;
+ }
if (write_scores (scorefile, scores, scorecount) < 0)
{
unlock_file (scorefile, lockstate);
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Wed, 23 Mar 2011 22:07:12 GMT)
Full text and
rfc822 format available.
Notification sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
bug acknowledged by developer.
(Wed, 23 Mar 2011 22:07:13 GMT)
Full text and
rfc822 format available.
Message #10 received at 8310-done <at> debbugs.gnu.org (full text, mbox):
I committed a fix to the trunk for this,
as part of a recent merge (bzr 103721).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 21 Apr 2011 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 123 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.