Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowsasfpicture.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:critical reason:data-parser
4
6
8
9QImage imageFromAsfFlatPicture(const BLOB &blob)
10{
11 if (blob.cbSize <= sizeof(QMM_ASF_FLAT_PICTURE))
12 return {};
13
14 const auto *pic = reinterpret_cast<const QMM_ASF_FLAT_PICTURE *>(blob.pBlobData);
15 const BYTE *p = blob.pBlobData + sizeof(QMM_ASF_FLAT_PICTURE);
16 const BYTE *end = blob.pBlobData + blob.cbSize;
17
18 // Skip MIME type (null-terminated UTF-16)
19 while (p + 1 < end && (p[0] || p[1]))
20 p += 2;
21 p += 2;
22 if (p > end)
23 return {};
24
25 // Skip description (null-terminated UTF-16)
26 while (p + 1 < end && (p[0] || p[1]))
27 p += 2;
28 p += 2;
29 if (p > end || pic->dwDataLen > static_cast<DWORD>(end - p))
30 return {};
31
32 QImage img;
33 img.loadFromData(p, pic->dwDataLen);
34 return img;
35}
36
37QT_END_NAMESPACE
Combined button and popup list for selecting options.