fix qt-qrcode memory corruption
[AGL/meta-agl-demo.git] / recipes-qt / qt-qrcode / qt-qrcode / 0002-fix-dangling-pointer.patch
1 From 5fc5a92e3568674a08a6e7594d050e963d0d854b Mon Sep 17 00:00:00 2001
2 From: Raquel Medina <raquel.medina@konsulko.com>
3 Date: Mon, 18 May 2020 19:18:00 +0200
4 Subject: [PATCH] fix dangling pointer
5
6 Bug-AGL: SPEC-3664
7 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com>
8 ---
9  lib/qtqrcode.cpp | 3 +--
10  1 file changed, 1 insertion(+), 2 deletions(-)
11
12 diff --git a/lib/qtqrcode.cpp b/lib/qtqrcode.cpp
13 index a7000f0..825c354 100644
14 --- a/lib/qtqrcode.cpp
15 +++ b/lib/qtqrcode.cpp
16 @@ -116,8 +116,7 @@ void QtQrCode::setBaseQrCodeData(QRcode *qrCode)
17  {
18      d->width = qrCode->width;
19      d->data.clear();
20 -    // TODO: Beware it here
21 -    d->data = (const char *) qrCode->data;
22 +    d->data = QByteArray(reinterpret_cast<const char *>(qrCode->data), d->width*d->width);
23      QRcode_free(qrCode);
24  }
25