File: exiftransform_fuzz_test.cpp

package info (click to toggle)
qtox 1.18.3-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 28,996 kB
  • sloc: cpp: 48,067; xml: 8,560; python: 704; sh: 232; makefile: 14
file content (28 lines) | stat: -rw-r--r-- 782 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "src/model/exiftransform.h"

#include <cassert>
#include <cstdlib>
#include <cstring>

namespace {

void test_getOrientation(const uint8_t* data, size_t size)
{
    ExifTransform::Orientation orientation =
        ExifTransform::getOrientation(QByteArray(reinterpret_cast<const char*>(data), size));
    assert(orientation >= ExifTransform::Orientation::TopLeft
           && orientation <= ExifTransform::Orientation::LeftBottom);
}

} // namespace

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
    qInstallMessageHandler([](QtMsgType, const QMessageLogContext&, const QString&) {
        // Ignore messages
    });

    test_getOrientation(data, size);
    return 0;
}