File: main_fuzzer.cpp

package info (click to toggle)
kdenlive 25.12.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 125,932 kB
  • sloc: cpp: 206,733; xml: 11,858; python: 1,139; ansic: 1,054; javascript: 578; sh: 389; makefile: 15
file content (34 lines) | stat: -rw-r--r-- 951 bytes parent folder | download | duplicates (3)
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
29
30
31
32
33
34
/*
    SPDX-FileCopyrightText: 2019 Nicolas Carion
    This file is part of Kdenlive. See www.kdenlive.org.

    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/

#include "core.h"
#include "fuzzing.hpp"
#include <QApplication>
#include <cstring>
#include <iostream>
#include <mlt++/MltFactory.h>
#include <mlt++/MltRepository.h>

int argc = 1;
char *argv[1] = {"fuzz"};
QApplication app(argc, argv);
std::unique_ptr<Mlt::Repository> repo(Mlt::Factory::init(nullptr));

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
    qputenv("MLT_TESTS", QByteArray("1"));
    Core::build(false);
    const char *input = reinterpret_cast<const char *>(data);
    char *target = new char[size + 1];
    strncpy(target, input, size);
    target[size] = '\0';
    std::string str(target);
    // std::cout<<"Testcase "<<str<<std::endl;
    fuzz(std::string(str));
    delete[] target;
    return 0;
}