Opened 3 years ago

Closed 3 years ago

#13648 closed defect (outdated)

Fix segfault in wxUIntProperty calling wxString::Format with wrong fmt

Reported by: jrl1 Owned by:
Priority: normal Milestone:
Component: wxPropertyGrid Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

wxUIntProperty::ValueToString() does not take into account that long can be 32 or 64 bits and so it needs to use a different wxString::Format() depending on the sizeof(long).

Without this patch wxUIntProperties segfault and are unusable on 64 bit linux w/ gcc.

The one line patch was made using this command in the root wxWidgets checkout dir.
$svn diff > wxuintproperty_string_format_patch.patch

Attachments (1)

wxuintproperty_string_format_patch.patch download (557 bytes) - added by jrl1 3 years ago.
svn diff > a.patch in root wxWidgets dir.

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by jrl1

svn diff > a.patch in root wxWidgets dir.

comment:1 Changed 3 years ago by vadz

  • Milestone 2.9.3 deleted
  • Patch unset
  • Priority changed from high to normal
  • Status changed from new to infoneeded_new

I don't believe this patch is correct, or at least its explanation isn't. On 64 bit systems using "%ld" (or "%lu", "%lx" &c) is absolutely the right thing to do for long values and printing them should work regardless of the exact size.

So what exactly is the problem and why does it crash?

comment:2 Changed 3 years ago by jrl1

  • Resolution set to outdated
  • Status changed from infoneeded_new to closed

I didn't notice that you had fixed the problem elsewhere since the code around my fix looked the same when I pasted my fix back in to make the patch.

http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/src/propgrid/props.cpp?view=log

http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/src/propgrid/props.cpp?r1=66728&r2=69113

Sorry about the trouble.

Note: See TracTickets for help on using tickets.