Opened 11 years ago

Closed 11 years ago

#9745 closed defect (fixed)

wxLongLong::GetLo broken on systems where sizeof(unsigned long) == 8

Reported by: botg Owned by:
Priority: critical Milestone:
Component: base Version:
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

On systems where sizeof(unsigned long) == 8, wxLongLong::GetLo (actually wxLongLongNative::GetLo) returns the complete 64bit number and not just the lower 32 bits.

I could reproduce this problem on x86_64 versions of Ubuntu 8.04 and Fedora Rawhide.

Bug exists in 2.8 branch as well as trunk.

Attachments (2)

longlongtest.patch download (403 bytes) - added by botg 11 years ago.
Testcase for bug
longlong.patch download (537 bytes) - added by botg 11 years ago.
Experimental fix

Download all attachments as: .zip

Change History (6)

comment:1 Changed 11 years ago by botg

  • Priority changed from high to critical

In programs relying on correct working of wxLongLong::GetLo(), this bug can lead to integer overflows, buffer overruns and similar.

comment:2 Changed 11 years ago by vadz

Do you have any code to reproduce the problem? Patches to tests/longlong/longlongtest.cpp would be especially appreciated, thanks.

Changed 11 years ago by botg

Testcase for bug

Changed 11 years ago by botg

Experimental fix

comment:3 Changed 11 years ago by botg

  • Patch set

I've attached a small patch that fixes this problem for me. Basically it just casts to wxUint32 instead of long.

I did not do a full audit of wxLongLong, there could be other problems with it as well.

comment:4 Changed 11 years ago by vadz

  • Resolution set to fixed
  • Status changed from new to closed

I see, this is the bug which was fixed by r45256 in trunk, backported to 2.8 as r54663 now.

Note: See TracTickets for help on using tickets.