[gnome-calculator] Math buttons: When updating the bits panel, shift a 1ULL instead of a 1LL
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Math buttons: When updating the bits panel, shift a 1ULL instead of a 1LL
- Date: Sun, 25 Sep 2016 01:16:40 +0000 (UTC)
commit 33e0820c584dc2b479d3dee6f6617a1df1ddf13d
Author: Tobias Mueller <muelli cryptobitch de>
Date: Sun Sep 18 05:39:47 2016 +0200
Math buttons: When updating the bits panel, shift a 1ULL instead of a 1LL
The 1 needs to be unsigned to be shifted by 63 positions properly.
The behaviour is undefined otherwise.
I found this with ASan:
math-buttons.c:610:25: runtime error: left shift of 1 by 63 places cannot be represented in type 'long
long int'
https://bugzilla.gnome.org/show_bug.cgi?id=771608
src/math-buttons.vala | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/math-buttons.vala b/src/math-buttons.vala
index e5c1534..6c549ba 100644
--- a/src/math-buttons.vala
+++ b/src/math-buttons.vala
@@ -164,7 +164,7 @@ public class MathButtons : Gtk.Box
foreach (var label in bit_labels)
{
var text = " 0";
- if ((bits & (1LL << i)) != 0)
+ if ((bits & (1ULL << i)) != 0)
text = " 1";
label.set_text (text);
i++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]