Ticket #13885 (reopened defect)

Opened 16 months ago

Last modified 6 months ago

wxCharBuffer.extend(len) bugfix

Reported by: troelsk Owned by:
Priority: high Milestone: 2.8.13
Component: base Version: 2.8.x
Keywords: wxCharBuffer Cc:
Blocked By: Patch: yes
Blocking:

Description

wxCharBuffer.extend(len) makes room for the zero terminator.
But it does not set it to 0 as it should (as the corresponding ctor does), so you end up with a non-terminated string.

This bug exists in both trunk and wx28 branch!

Attachments

charbuffer.patch download (1.1 KB) - added by troelsk 16 months ago.
Trunk
charbuffer28.patch download (0.7 KB) - added by troelsk 16 months ago.
2.8 branch
changes.txt.wx28.patch download (345 bytes) - added by troelsk 13 months ago.
2.8 branch
charbuffer-trunk.patch download (2.0 KB) - added by troelsk 6 months ago.
Remove redundant termination code, in trunk

Change History

Changed 16 months ago by troelsk

Trunk

Changed 16 months ago by troelsk

2.8 branch

Changed 16 months ago by VZ

  • status changed from new to closed
  • resolution set to fixed

(In [70417]) Ensure wxCharTypeBuffer data is NUL-terminated after extend() call.

As wxCharTypeBuffer ctor taking the length NUL-terminates the buffer, it may
be expected that extend() does the same but it did not. Do add the NUL at the
end for consistency, even though it's not really needed for the existing code
using extend() in wxWidgets itself.

Closes #13885.

Changed 13 months ago by troelsk

  • priority changed from normal to high
  • status changed from closed to reopened
  • version changed from 2.9-svn to 2.8.x
  • resolution deleted
  • milestone set to 2.8.13

Changed 13 months ago by troelsk

2.8 branch

Changed 6 months ago by troelsk

Remove redundant termination code, in trunk

Changed 6 months ago by troelsk

Added patch removing unnecessary termination code in trunk

Changed 6 months ago by VZ

(In [73141]) Don't unnecessarily NUL-terminate wxCharBuffer contents.

wxCharBuffer already initializes the last byte of the buffer it allocates to 0
so there is no need to do it explicitly.

Also don't allocate an extra byte, wxCharBuffer already adds one to the length
passed to it for the trailing NUL.

See #13885.

Note: See TracTickets for help on using tickets.