Replies: 3 comments
-
We changed the test case to: #include <Magick++/Image.h> #include "utils.cc" namespace MagickCore extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { (void) HuffmanDecodeImage(image.image()); TEST RESULTS: But, we use gdb print image.image()->blob that's value is not NULL It's so weird!! DEBUG RESULTS: |
Beta Was this translation helpful? Give feedback.
-
I have solved it. …… |
Beta Was this translation helpful? Give feedback.
-
Correct. The default build for ImageMagick 7 series is to enable HDRI. However, for the V6 series, the default is non-HDRI. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We need to run fuzz test cases on ImageMagicK6. These test cases come from oss-fuzz. The fuzz test cases were originally used to test ImageMagicK7. We port them to ImageMagicK6.
google/oss-fuzz@6813e36#diff-624cf98e0975957fdc7e8043c5405930c60a31070add4bbdd0da31648f69bedd
During the test, we found that these fuzz use cases would fail to execute, take huffman_decode_fuzzer.cc as an example:
`#include
#include <Magick++/Blob.h>
#include <Magick++/Image.h>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
const Magick::Blob blob(Data, Size);
Magick::Image image;
try {
image.read(blob);
} catch (Magick::Exception &e) {
return 0;
}
Magick::ExceptionInfo ex;
auto res = HuffmanDecodeImage(image.image(), &ex);
return 0;
}`
TEST RESULTS:
src/imagemagick/Magick++/lib/Exception.cpp:199^M
NEW_FUNC[2/9]: 0x6ab180 in InterpretDelegateProperties /src/imagemagick/magick/delegate.c:926^M
#3637 NEW cov: 1724 ft: 3236 corp: 97/400b lim: 6 exec/s: 606 rss: 104Mb L: 6/6 MS: 1 CMP- DE: "HTML"-^M
#3650 NEW cov: 1724 ft: 3237 corp: 98/406b lim: 6 exec/s: 608 rss: 104Mb L: 6/6 MS: 3 ChangeByte-ChangeBit-ChangeBit-^M
huffman_decode_fuzzer: magick/blob.c:3291: int ReadBlobByte(Image *): Assertion `image->blob->type != UndefinedStream' failed.^M
AddressSanitizer:DEADLYSIGNAL^M
================================================================
^[[1m^[[31m==13==ERROR: AddressSanitizer: ABRT on unknown address 0x00000000000d (pc 0x7f40054e7428 bp 0x000000b797e0 sp 0x7ffe3c47be28 T0)
^[[1m^[[0mSCARINESS: 10 (signal)
#0 0x7f40054e7428 in raise (/lib/x86_64-linux-gnu/libc.so.6+0x35428)
#1 0x7f40054e9029 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x37029)
#2 0x7f40054dfbd6 (/lib/x86_64-linux-gnu/libc.so.6+0x2dbd6)
#3 0x7f40054dfc81 in __assert_fail (/lib/x86_64-linux-gnu/libc.so.6+0x2dc81)
#4 0x631aed in ReadBlobByte /src/imagemagick/magick/blob.c:3291:3
#5 0x692138 in HuffmanDecodeImage /src/imagemagick/magick/compress.c:501:4
#6 0x4ca365 in LLVMFuzzerTestOneInput /src/huffman_decode_fuzzer.cc:15:14
#7 0x5168a6 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:556:15
#8 0x512ea0 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:470:3
#9 0x5182ef in fuzzer::Fuzzer::MutateAndTestOne() /src/libfuzzer/FuzzerLoop.cpp:698:19
#10 0x51b22d in fuzzer::Fuzzer::Loop(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocatorfuzzer::SizedFile >&) /src/libfuzzer/FuzzerLoop.cpp:832:5
#11 0x4d860f in fuzzer::FuzzerDriver(int*, char***, int ()(unsigned char const, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:826:6
#12 0x4ca5d7 in main /src/libfuzzer/FuzzerMain.cpp:19:10
#13 0x7f40054d282f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#14 0x41f5a8 in _start (/out/huffman_decode_fuzzer+0x41f5a8)
Beta Was this translation helpful? Give feedback.
All reactions