Commit b6f280ae authored by Pino Toscano's avatar Pino Toscano

tests: fix memory access in testnotificationlistener

set the image data as QByteArray of the right size, otherwise
referencing a stack-based char data will be problematic when the
function is out of scope
parent 4bcb4090
...@@ -426,7 +426,7 @@ void TestNotificationListener::testNotify() ...@@ -426,7 +426,7 @@ void TestNotificationListener::testNotify()
0x31, 0x32, 0x33, 0x34 }; 0x31, 0x32, 0x33, 0x34 };
QVariantMap imageData = {{"width", width}, {"height", height}, {"rowStride", rowStride}, QVariantMap imageData = {{"width", width}, {"height", height}, {"rowStride", rowStride},
{"bitsPerSample", bitsPerSample}, {"channels", channels}, {"bitsPerSample", bitsPerSample}, {"channels", channels},
{"hasAlpha", hasAlpha}, {"imageData", rawData}}; {"hasAlpha", hasAlpha}, {"imageData", QByteArray(rawData, sizeof(rawData))}};
QVariantMap hints; QVariantMap hints;
#define COMPARE_PIXEL(x, y) \ #define COMPARE_PIXEL(x, y) \
QCOMPARE(qRed(image.pixel(x,y)), (int)rawData[x*4 + y*rowStride + 0]); \ QCOMPARE(qRed(image.pixel(x,y)), (int)rawData[x*4 + y*rowStride + 0]); \
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment