RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
/*
2
RawSpeed - RAW file decoder.
3
4
Copyright (C) 2017 Roman Lebedev
5
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
10
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#ifndef DECODER
22
#error DECODER must be defined
23
#endif
24
25
#include "
adt/Casts.h
"
26
#include "
common/RawspeedException.h
"
27
#include "
decoders/ArwDecoder.h
"
// IWYU pragma: keep
28
#include "
decoders/Cr2Decoder.h
"
// IWYU pragma: keep
29
#include "
decoders/DcrDecoder.h
"
// IWYU pragma: keep
30
#include "
decoders/DcsDecoder.h
"
// IWYU pragma: keep
31
#include "
decoders/DngDecoder.h
"
// IWYU pragma: keep
32
#include "
decoders/ErfDecoder.h
"
// IWYU pragma: keep
33
#include "
decoders/IiqDecoder.h
"
// IWYU pragma: keep
34
#include "
decoders/KdcDecoder.h
"
// IWYU pragma: keep
35
#include "
decoders/MefDecoder.h
"
// IWYU pragma: keep
36
#include "
decoders/MosDecoder.h
"
// IWYU pragma: keep
37
#include "
decoders/NefDecoder.h
"
// IWYU pragma: keep
38
#include "
decoders/OrfDecoder.h
"
// IWYU pragma: keep
39
#include "
decoders/PefDecoder.h
"
// IWYU pragma: keep
40
#include "
decoders/RafDecoder.h
"
// IWYU pragma: keep
41
#include "
decoders/Rw2Decoder.h
"
// IWYU pragma: keep
42
#include "
decoders/SrwDecoder.h
"
// IWYU pragma: keep
43
#include "
decoders/StiDecoder.h
"
// IWYU pragma: keep
44
#include "
decoders/ThreefrDecoder.h
"
// IWYU pragma: keep
45
#include "
io/Buffer.h
"
46
#include "
metadata/CameraMetaData.h
"
47
#include "
parsers/TiffParser.h
"
48
#include <cassert>
49
#include <cstdint>
50
#include <cstdio>
51
#include <memory>
52
#include <utility>
53
54
static
const
rawspeed::CameraMetaData
metadata
{};
55
56
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t* Data,
size_t
Size);
57
58
using
rawspeed::DECODER;
59
60
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t* Data,
size_t
Size) {
61
assert
(Data);
62
63
try
{
64
const
rawspeed::Buffer
buffer(
65
Data,
rawspeed::implicit_cast<rawspeed::Buffer::size_type>
(Size));
66
auto
ifd =
rawspeed::TiffParser::parse
(
nullptr
, buffer);
67
68
// ATM do not care if this is the appropriate decoder.
69
// only check that the check does not crash.
70
(void)DECODER::isAppropriateDecoder(ifd.get(), buffer);
71
72
auto
decoder = std::make_unique<DECODER>(std::move(ifd), buffer);
73
74
decoder->applyCrop =
false
;
75
decoder->interpolateBadPixels =
false
;
76
decoder->failOnUnknown =
false
;
77
// decoder->checkSupport(&metadata);
78
79
decoder->decodeRaw();
80
decoder->decodeMetaData(&
metadata
);
81
82
}
catch
(
const
rawspeed::RawspeedException
&) {
83
return
0;
84
}
85
86
return
0;
87
}
ArwDecoder.h
Buffer.h
CameraMetaData.h
Casts.h
Cr2Decoder.h
DcrDecoder.h
DcsDecoder.h
DngDecoder.h
ErfDecoder.h
IiqDecoder.h
KdcDecoder.h
MefDecoder.h
MosDecoder.h
NefDecoder.h
OrfDecoder.h
PefDecoder.h
RafDecoder.h
RawspeedException.h
Rw2Decoder.h
SrwDecoder.h
StiDecoder.h
ThreefrDecoder.h
TiffParser.h
assert
assert(dim.area() >=area)
rawspeed::Buffer
Definition
Buffer.h:47
rawspeed::CameraMetaData
Definition
CameraMetaData.h:47
rawspeed::RawspeedException
Definition
RawspeedException.h:56
rawspeed::TiffParser::parse
static TiffRootIFDOwner parse(TiffIFD *parent, Buffer data)
Definition
TiffParser.cpp:66
LLVMFuzzerTestOneInput
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
Definition
main.cpp:60
metadata
static const rawspeed::CameraMetaData metadata
Definition
main.cpp:54
rawspeed::implicit_cast
constexpr RAWSPEED_READNONE Ttgt implicit_cast(Tsrc value)
Definition
Casts.h:32
fuzz
librawspeed
decoders
TiffDecoders
main.cpp
Generated by
1.15.0