### ImageMagick version

7.1.1-30

### Operating system

Linux

### Operating system, version and so on

Ubuntu 20.04 LTS

### Description

```
MagickCore/memory.c:847: void *CopyMagickMemory(void *restrict, const void *restrict, const size_t): 
Assertion `source != (const void *) NULL' failed.

libfuzzer target:

./encoder_png_fuzzer /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-
fuzz/out/png_out/default/crashes/id:000000,sig:04,src:002077_time:45323255_execs:100334310_op:havoc_rep:16
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3789053952
INFO: Loaded 1 modules   (42 inline 8-bit counters): 42 [0x5614486ccb50, 0x5614486ccb7a), 
INFO: Loaded 1 PC tables (42 PCs): 42 [0x5614486ccb80,0x5614486cce20), 
./encoder_png_fuzzer: Running 1 inputs 1 time(s) each.
Running: /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out/png_out/default/crashes/id:000000,sig:04,src:002077_time:45323255_execs:100334310_op:havoc_rep:16
encoder_png_fuzzer: MagickCore/memory.c:847: void *CopyMagickMemory(void *restrict, const void *restrict, const size_t): Assertion `source != (const void *) NULL' failed.
==40564== ERROR: libFuzzer: deadly signal
    #0 0x5614479a487e in __sanitizer_print_stack_trace /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/asan/asan_stack.cpp:87:3
    #1 0x5614478e8211 in fuzzer::PrintStackTrace() /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtil.cpp:210:38
    #2 0x5614478c19a6 in fuzzer::Fuzzer::CrashCallback() (.part.0) /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:233:18
    #3 0x5614478c1a72 in fuzzer::Fuzzer::CrashCallback() /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:205:1
    #4 0x5614478c1a72 in fuzzer::Fuzzer::StaticCrashSignalCallback() /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:204:19
    #5 0x7fe3eff7541f  (/lib/x86_64-linux-gnu/libpthread.so.0+0x1441f) (BuildId: 0c044ba611aeeeaebb8374e660061f341ebc0bac)
    #6 0x7fe3ef30b00a in __libc_signal_restore_set /build/glibc-wuryBv/glibc-2.31/signal/../sysdeps/unix/sysv/linux/internal-signals.h:86:3
    #7 0x7fe3ef30b00a in raise /build/glibc-wuryBv/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:48:3
    #8 0x7fe3ef2ea858 in abort /build/glibc-wuryBv/glibc-2.31/stdlib/abort.c:79:7
    #9 0x7fe3ef2ea728 in __assert_fail_base /build/glibc-wuryBv/glibc-2.31/assert/assert.c:92:3
    #10 0x7fe3ef2fbfd5 in __assert_fail /build/glibc-wuryBv/glibc-2.31/assert/assert.c:101:3
    #11 0x561447b77521 in CopyMagickMemory (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x64b521)
    #12 0x561447e0f207 in PNGSetExifProfile png.c
    #13 0x561447e0e421 in read_user_chunk_callback png.c
    #14 0x561447e54c1f in png_handle_unknown (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x928c1f)
    #15 0x561447e3e2ce in png_read_info (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x9122ce)
    #16 0x561447e07974 in ReadOnePNGImage png.c
    #17 0x561447dfc209 in ReadPNGImage png.c
    #18 0x561447aa78f4 in ReadImage (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x57b8f4)
    #19 0x561447a62aa4 in BlobToImage (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x536aa4)
    #20 0x5614479e8db7 in Magick::Image::read(Magick::Blob const&) (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x4bcdb7)
    #21 0x5614479e177e in LLVMFuzzerTestOneInput /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/encoder_fuzzer.cc:77:11
    #22 0x5614478c23d1 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:17
    #23 0x5614478a45f4 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:21
    #24 0x5614478af781 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:860:19
    #25 0x5614478e97e6 in main /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:30
    #26 0x7fe3ef2ec082 in __libc_start_main /build/glibc-wuryBv/glibc-2.31/csu/../csu/libc-start.c:308:16
    #27 0x56144789c7ad in _start (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x3707ad)

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal

```

-----------
afl-style target: Illegal Instruction

```
./encoder_png_fuzzer  /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out/png_out/default/crashes/id:000000,sig:04,src:002077_time:45323255_execs:100334310_op:havoc_rep:16
Reading 198 bytes from /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out/png_out/default/crashes/id:000000,sig:04,src:002077_time:45323255_execs:100334310_op:havoc_rep:16
Illegal instruction (core dumped)
```



### Steps to Reproduce

1. compile the oss-fuzz taregt with libfuzzer or afl++.
2. run target with [poc.zip](https://github.com/ImageMagick/ImageMagick/files/14995400/poc.zip).

```
./encoder_png_fuzzer ./poc
```

### Images

_No response_
MagickCore/memory.c:847 Assertion failed
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : MagickCore/memory.c:847 Assertion failed
Issue date:

--- start body ---
### ImageMagick version

7.1.1-30

### Operating system

Linux

### Operating system, version and so on

Ubuntu 20.04 LTS

### Description

```
MagickCore/memory.c:847: void *CopyMagickMemory(void *restrict, const void *restrict, const size_t): 
Assertion `source != (const void *) NULL' failed.

libfuzzer target:

./encoder_png_fuzzer /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-
fuzz/out/png_out/default/crashes/id:000000,sig:04,src:002077_time:45323255_execs:100334310_op:havoc_rep:16
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3789053952
INFO: Loaded 1 modules   (42 inline 8-bit counters): 42 [0x5614486ccb50, 0x5614486ccb7a), 
INFO: Loaded 1 PC tables (42 PCs): 42 [0x5614486ccb80,0x5614486cce20), 
./encoder_png_fuzzer: Running 1 inputs 1 time(s) each.
Running: /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out/png_out/default/crashes/id:000000,sig:04,src:002077_time:45323255_execs:100334310_op:havoc_rep:16
encoder_png_fuzzer: MagickCore/memory.c:847: void *CopyMagickMemory(void *restrict, const void *restrict, const size_t): Assertion `source != (const void *) NULL' failed.
==40564== ERROR: libFuzzer: deadly signal
    #0 0x5614479a487e in __sanitizer_print_stack_trace /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/asan/asan_stack.cpp:87:3
    #1 0x5614478e8211 in fuzzer::PrintStackTrace() /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtil.cpp:210:38
    #2 0x5614478c19a6 in fuzzer::Fuzzer::CrashCallback() (.part.0) /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:233:18
    #3 0x5614478c1a72 in fuzzer::Fuzzer::CrashCallback() /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:205:1
    #4 0x5614478c1a72 in fuzzer::Fuzzer::StaticCrashSignalCallback() /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:204:19
    #5 0x7fe3eff7541f  (/lib/x86_64-linux-gnu/libpthread.so.0+0x1441f) (BuildId: 0c044ba611aeeeaebb8374e660061f341ebc0bac)
    #6 0x7fe3ef30b00a in __libc_signal_restore_set /build/glibc-wuryBv/glibc-2.31/signal/../sysdeps/unix/sysv/linux/internal-signals.h:86:3
    #7 0x7fe3ef30b00a in raise /build/glibc-wuryBv/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:48:3
    #8 0x7fe3ef2ea858 in abort /build/glibc-wuryBv/glibc-2.31/stdlib/abort.c:79:7
    #9 0x7fe3ef2ea728 in __assert_fail_base /build/glibc-wuryBv/glibc-2.31/assert/assert.c:92:3
    #10 0x7fe3ef2fbfd5 in __assert_fail /build/glibc-wuryBv/glibc-2.31/assert/assert.c:101:3
    #11 0x561447b77521 in CopyMagickMemory (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x64b521)
    #12 0x561447e0f207 in PNGSetExifProfile png.c
    #13 0x561447e0e421 in read_user_chunk_callback png.c
    #14 0x561447e54c1f in png_handle_unknown (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x928c1f)
    #15 0x561447e3e2ce in png_read_info (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x9122ce)
    #16 0x561447e07974 in ReadOnePNGImage png.c
    #17 0x561447dfc209 in ReadPNGImage png.c
    #18 0x561447aa78f4 in ReadImage (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x57b8f4)
    #19 0x561447a62aa4 in BlobToImage (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x536aa4)
    #20 0x5614479e8db7 in Magick::Image::read(Magick::Blob const&) (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x4bcdb7)
    #21 0x5614479e177e in LLVMFuzzerTestOneInput /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/encoder_fuzzer.cc:77:11
    #22 0x5614478c23d1 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:17
    #23 0x5614478a45f4 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:21
    #24 0x5614478af781 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:860:19
    #25 0x5614478e97e6 in main /home/fuzz/Desktop/fuzz-introspector/build/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:30
    #26 0x7fe3ef2ec082 in __libc_start_main /build/glibc-wuryBv/glibc-2.31/csu/../csu/libc-start.c:308:16
    #27 0x56144789c7ad in _start (/home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out_libfuzzer/encoder_png_fuzzer+0x3707ad)

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal

```

-----------
afl-style target: Illegal Instruction

```
./encoder_png_fuzzer  /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out/png_out/default/crashes/id:000000,sig:04,src:002077_time:45323255_execs:100334310_op:havoc_rep:16
Reading 198 bytes from /home/fuzz/Desktop/DDGF_Project/OSS-Test/ImageMagick/oss-fuzz/out/png_out/default/crashes/id:000000,sig:04,src:002077_time:45323255_execs:100334310_op:havoc_rep:16
Illegal instruction (core dumped)
```



### Steps to Reproduce

1. compile the oss-fuzz taregt with libfuzzer or afl++.
2. run target with [poc.zip](https://github.com/ImageMagick/ImageMagick/files/14995400/poc.zip).

```
./encoder_png_fuzzer ./poc
```

### Images

_No response_
--- end body ---

An assertion failure in the CopyMagickMemory function of ImageMagick v7.1.1-30 can lead to a Denial of Service (DoS) when processing specially crafted PNG files. The assertion `source != (const void *) NULL` fails, indicating that the function is attempting to copy memory from a null pointer, which can cause the application to crash.