[PD-dev] [ pure-data-Patches-3505262 ] slightly increase buffers when dealing with UTF8

SourceForge.net noreply at sourceforge.net
Thu Mar 15 16:22:21 CET 2012


Patches item #3505262, was opened at 2012-03-15 07:33
Message generated for change (Comment added) made by creamygoodness
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3505262&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: IOhannes m zmölnig (zmoelnig)
Assigned to: Miller Puckette (millerpuckette)
Summary: slightly increase buffers when dealing with UTF8

Initial Comment:
running Pd through valgrind [1] gives a number of "Invalid read" errors, as soon as you create an object and type a single letter (e.g. "f").
creating the object (by licking besides it), gives another number of "Invalid read" errors.

those errors suggest that memory outside the allocated buffer is accessed. it seems that all these errors are related to the UTF-8 code (since with utf-8 we might have to check multiple bytes).

the attached fix simply increases the allocated buffer slightly (more than what happens already), so the read can take place on safe grounds.


[1] like with $ valgrind --tool=memcheck   --leak-check=full ./src/pd -noprefs -nrt -noaudio -stderr


----------------------------------------------------------------------

Comment By: Marvin Humphrey (creamygoodness)
Date: 2012-03-15 08:22

Message:
The existing UTF-8 processing code assumes that strings are NUL-terminated
and feels free to access that NUL byte beyond the buffer. However, the
strings PD uses are always paired with a length, so it is possible to
perform UTF-8 processing without going past the end of the buffer.  That
other patch gets rid of the overruns, and applying it should indeed clear
the Valgrind errors that inspired both patches.

----------------------------------------------------------------------

Comment By: IOhannes m zmölnig (zmoelnig)
Date: 2012-03-15 07:47

Message:
seems like it is duplicate patches day for me:
https://sourceforge.net/tracker/?func=detail&aid=3420484&group_id=55736&atid=478072

i haven't really checked the other patch, but it seems like it addresses
the same issues while curing the cause rather than the symptoms.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3505262&group_id=55736



More information about the Pd-dev mailing list