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
#include "
adt/Casts.h
"
22
#ifndef PARSER
23
#error PARSER must be defined
24
#endif
25
26
#ifndef GETDECODER
27
#error GETDECODER must be defined as bool
28
#endif
29
30
#ifndef DECODE
31
#error DECODE must be defined as bool
32
#endif
33
34
#include "
io/Buffer.h
"
35
#include "
io/IOException.h
"
36
#include "
parsers/CiffParser.h
"
// IWYU pragma: keep
37
#include "
parsers/FiffParser.h
"
// IWYU pragma: keep
38
#include "
parsers/RawParser.h
"
// IWYU pragma: keep
39
#include "
parsers/RawParserException.h
"
40
#include "
parsers/TiffParser.h
"
41
#include <cassert>
42
#include <cstdint>
43
#include <cstdio>
44
45
#if GETDECODER
46
#include "
decoders/RawDecoderException.h
"
47
#if DECODE
48
#include "
common/RawspeedException.h
"
49
#include "
metadata/CameraMetaData.h
"
50
#include <memory>
51
#endif
52
#endif
53
54
#if GETDECODER && DECODE
55
static
const
rawspeed::CameraMetaData
metadata
{};
56
#endif
57
58
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t* Data,
size_t
Size);
59
60
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t* Data,
size_t
Size) {
61
assert
(Data);
62
63
const
rawspeed::Buffer
buffer(
64
Data,
rawspeed::implicit_cast<rawspeed::Buffer::size_type>
(Size));
65
66
try
{
67
rawspeed::PARSER parser(buffer);
68
69
#if GETDECODER
70
#if DECODE
71
auto
decoder =
72
#endif
73
parser.getDecoder();
74
#endif
75
76
#if DECODE
77
decoder->applyCrop =
false
;
78
decoder->interpolateBadPixels =
false
;
79
decoder->failOnUnknown =
false
;
80
// decoder->checkSupport(&metadata);
81
82
decoder->decodeRaw();
83
decoder->decodeMetaData(&
metadata
);
84
#endif
85
}
catch
(
const
rawspeed::RawParserException
&) {
86
return
0;
87
#if GETDECODER
88
}
catch
(
const
rawspeed::RawDecoderException
&) {
89
return
0;
90
#endif
91
}
catch
(
const
rawspeed::IOException
&) {
92
return
0;
93
#if DECODE
94
}
catch
(
const
rawspeed::RawspeedException
&) {
95
return
0;
96
#endif
97
}
98
99
return
0;
100
}
Buffer.h
CameraMetaData.h
Casts.h
CiffParser.h
FiffParser.h
IOException.h
RawDecoderException.h
RawParser.h
RawParserException.h
RawspeedException.h
TiffParser.h
assert
assert(dim.area() >=area)
rawspeed::Buffer
Definition
Buffer.h:47
rawspeed::CameraMetaData
Definition
CameraMetaData.h:47
rawspeed::IOException
Definition
IOException.h:30
rawspeed::RawDecoderException
Definition
RawDecoderException.h:30
rawspeed::RawParserException
Definition
RawParserException.h:29
rawspeed::RawspeedException
Definition
RawspeedException.h:56
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
parsers
main.cpp
Generated by
1.15.0