**System info**
Ubuntu x86_64, clang 10.0
version: 0.12.4.4643, last commit [93c2512](https://github.com/LibreDWG/libredwg/commit/93c25124c191987af168ace9fe4b5623061874bd)

**Command line**
./dwg2dxf poc

**Poc**
poc : [poc](https://github.com/iorra-cifer/Poc/blob/main/libredwg/Nullpointer_2?raw=true) 

**AddressSanitizer output**
==4083103==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f9ed611a461 bp 0x7ffe67ee4170 sp 0x7ffe67ee3928 T0)
==4083103==The signal is caused by a READ memory access.
==4083103==Hint: address points to the zero page.
    #0 0x7f9ed611a461  /build/glibc-CVJwZb/glibc-2.27/string/../sysdeps/x86_64/multiarch/strlen-avx2.S:65
    #1 0x42e128 in strlen /home/brian/src/final/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc
    #2 0x1441668 in dwg_add_u8_input /home/SVF-tools/example/libredwg-2/src/dwg_api.c:22216:41
    #3 0x1450aa4 in dwg_add_BLOCK_HEADER /home/SVF-tools/example/libredwg-2/src/dwg_api.c:24594:3
    #4 0x11764e3 in decode_preR13_section /home/SVF-tools/example/libredwg-2/src/decode_r11.c:308:20
    #5 0x111f472 in decode_preR13 /home/SVF-tools/example/libredwg-2/src/decode_r11.c:809:12
    #6 0x4fb4b6 in dwg_decode /home/SVF-tools/example/libredwg-2/src/decode.c:211:17
    #7 0x4c6dcc in dwg_read_file /home/SVF-tools/example/libredwg-2/src/dwg.c:254:11
    #8 0x4c4a40 in main /home/SVF-tools/example/libredwg-2/programs/dwg2dxf.c:258:15
    #9 0x7f9ed5fadc86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310
    #10 0x41b649 in _start (/home/SVF-tools/example/libredwg-2/fuzz/dwg2dxf.ci+0x41b649)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /build/glibc-CVJwZb/glibc-2.27/string/../sysdeps/x86_64/multiarch/strlen-avx2.S:65
==4083103==ABORTING

A NULL pointer dereference exists in the function dwg_add_u8_input in dwg_api.c
This is a GitHub Issue
repo:libredwg
owner:LibreDWG
Title : A NULL pointer dereference exists in the function dwg_add_u8_input in dwg_api.c
Issue date:

--- start body ---
**System info**
Ubuntu x86_64, clang 10.0
version: 0.12.4.4643, last commit [93c2512](https://github.com/LibreDWG/libredwg/commit/93c25124c191987af168ace9fe4b5623061874bd)

**Command line**
./dwg2dxf poc

**Poc**
poc : [poc](https://github.com/iorra-cifer/Poc/blob/main/libredwg/Nullpointer_2?raw=true) 

**AddressSanitizer output**
==4083103==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f9ed611a461 bp 0x7ffe67ee4170 sp 0x7ffe67ee3928 T0)
==4083103==The signal is caused by a READ memory access.
==4083103==Hint: address points to the zero page.
    #0 0x7f9ed611a461  /build/glibc-CVJwZb/glibc-2.27/string/../sysdeps/x86_64/multiarch/strlen-avx2.S:65
    #1 0x42e128 in strlen /home/brian/src/final/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc
    #2 0x1441668 in dwg_add_u8_input /home/SVF-tools/example/libredwg-2/src/dwg_api.c:22216:41
    #3 0x1450aa4 in dwg_add_BLOCK_HEADER /home/SVF-tools/example/libredwg-2/src/dwg_api.c:24594:3
    #4 0x11764e3 in decode_preR13_section /home/SVF-tools/example/libredwg-2/src/decode_r11.c:308:20
    #5 0x111f472 in decode_preR13 /home/SVF-tools/example/libredwg-2/src/decode_r11.c:809:12
    #6 0x4fb4b6 in dwg_decode /home/SVF-tools/example/libredwg-2/src/decode.c:211:17
    #7 0x4c6dcc in dwg_read_file /home/SVF-tools/example/libredwg-2/src/dwg.c:254:11
    #8 0x4c4a40 in main /home/SVF-tools/example/libredwg-2/programs/dwg2dxf.c:258:15
    #9 0x7f9ed5fadc86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310
    #10 0x41b649 in _start (/home/SVF-tools/example/libredwg-2/fuzz/dwg2dxf.ci+0x41b649)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /build/glibc-CVJwZb/glibc-2.27/string/../sysdeps/x86_64/multiarch/strlen-avx2.S:65
==4083103==ABORTING

--- end body ---

A NULL pointer dereference vulnerability exists in the function dwg_add_u8_input in dwg_api.c of LibreDWG version 0.12.4.4643. This vulnerability can lead to a segmentation fault when the function attempts to read from a NULL pointer, which can be exploited by providing a specially crafted input file to the dwg2dxf program. The AddressSanitizer output indicates that the program attempts to access memory at address 0x000000000000, resulting in a crash.