[wx-dev] #9739: {From,To}8BitData causes data corruption

wxTrac noreply at wxsite.net
Tue Jul 15 08:20:37 PDT 2008


Ticket URL: <http://trac.wxwidgets.org/ticket/9739>

#9739: {From,To}8BitData causes data corruption
----------------------+-----------------------------------------------------
 Reporter:  glutter   |       Owner:         
     Type:  defect    |      Status:  new    
 Priority:  normal    |   Milestone:         
Component:  base      |     Version:  2.8.7.1
 Keywords:  wxString  |   Blockedby:         
    Patch:  0         |    Blocking:         
----------------------+-----------------------------------------------------
 Hello Community,

 this is my first bug report/ticket on wxWidgets ;-). I hope my description
 is sufficient to hunt this bug.

 Here is a minimum example where I get the data corruption:

 {{{
 #include <wx/string.h>
 int main() {
   char test[] = {0xfe, 0x03, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xc8,
 0x00, 0x00, 0x00, 0x40, 0x9c, 0x00, 0x00, 0xfd, 0x04};
   wxString temp = wxString::From8BitData(test, 18);
   char *copied = temp.To8BitData().release();
   for (int i = 0; i < 18; i++) {
     wxPrintf(wxT("0x%.2hhX "), copied[i]);
   }
   free(copied);
   return 0;
 }
 }}}


 I've compiled this example with the following options:
 {{{g++ `wx-config --cxxflags base` `wx-config --libs base` -o test
 test.cpp}}}

 The output of this minimum example is:
 {{{0xFE 0x03 0x01 0x0C 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x0C 0x00
 0x00 0x00 0x00 0x00}}}
 and that is different from the input.

 The system I'm using is linux-x86_84-2.6.25/g{cc,++}4.1.2/wxGTK-2.8.7.1

 Best regards
 Gerald


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9739>


More information about the wx-dev mailing list