PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 994 - QIODevice.readData must use qmemcpy instead of qstrncpy
: QIODevice.readData must use qmemcpy instead of qstrncpy
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: PySide
: HEAD
: PC All
: P3 normal
Assigned To: Hugo Parente Lima
:
:
:
  Show dependency treegraph
 
Reported: 2011-08-31 22:11 EEST by Yui Hirasawa
Modified: 2011-09-21 20:49 EEST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yui Hirasawa 2011-08-31 22:11:57 EEST
The current conversion code for QIODevice.readData(), readLineData(), etc. is
here (PySide/QtCore/typesystem_core.xml):

                    %out = PyString_GET_SIZE((PyObject*)%PYARG_0);
                    qstrncpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out
+ 

This conversion doesn't work correctly if return data have '\0' in the middle
of them.

This code must use qmemcpy instead of qstrncpy, because QIODevice.readData()
must be able to return arbitrary binary data which may have some '\0'.
Comment 1 Hugo Parente Lima 2011-09-01 01:18:56 EEST
Fixed in commit:

pyside/1261f293486caa7df9e6d18c14bb0b141f12e7f5

Thanks for pointing us this issue!
Comment 2 Yui Hirasawa 2011-09-01 09:36:57 EEST
Thank you for fixing!

However, I found that qstrncpy is still used at QIODevice.read(),
QIODevice.readLine() and QIODevice.readLineData(). I'm afraid they may cause
the same problem.
Comment 3 Hugo Parente Lima 2011-09-01 16:41:52 EEST
Yes, they will cause.

I'm reopening the bug just as a reminder to me to fix/review all QIODevice
functions.

thanks!
Comment 4 Hugo Parente Lima 2011-09-01 21:51:46 EEST
Fixed in commit:

pyside/abadd5078f7ee4257838b321286220fb27cdd17b

Thanks.
Comment 5 renato filho 2011-09-21 20:49:27 EEST
Release 1.0.7