QPictureIO::read(): don't work on dangling pointer
QPictureIO::read() is using pictureFormat() when the format has to be guessed. pictureFormat() returns a QByteArray which was implicit casted into a char* and then pointed to uninitialized memory. Fix it by using a QByteArray instead a plain char*. Change-Id: If9ae286ed68134af597f0b0c779789e40f9efaed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
f383fa4b9c
commit
0bde49bd92
@ -1866,7 +1866,7 @@ QList<QByteArray> QPictureIO::outputFormats()
|
||||
bool QPictureIO::read()
|
||||
{
|
||||
QFile file;
|
||||
const char *picture_format;
|
||||
QByteArray picture_format;
|
||||
QPictureHandler *h;
|
||||
|
||||
if (d->iodev) { // read from io device
|
||||
@ -1882,7 +1882,7 @@ bool QPictureIO::read()
|
||||
if (d->frmt.isEmpty()) {
|
||||
// Try to guess format
|
||||
picture_format = pictureFormat(d->iodev); // get picture format
|
||||
if (!picture_format) {
|
||||
if (picture_format.isEmpty()) {
|
||||
if (file.isOpen()) { // unknown format
|
||||
file.close();
|
||||
d->iodev = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user