issue_owner_repo
listlengths
2
2
issue_body
stringlengths
0
261k
issue_title
stringlengths
1
925
issue_comments_url
stringlengths
56
81
issue_comments_count
int64
0
2.5k
issue_created_at
stringlengths
20
20
issue_updated_at
stringlengths
20
20
issue_html_url
stringlengths
37
62
issue_github_id
int64
387k
2.46B
issue_number
int64
1
127k
[ "LibreDWG", "libredwg" ]
In the LTYPE section, num_dashes is not written, although it should be according to the code. ``` FIELD_TFv (description, 48, 3); FIELD_RC (alignment, 72); FIELD_RCu (num_dashes, 73); FIELD_RD (pattern_len, 40); FIELD_VECTOR (dashes_r11, RD, num_dashes, 49); ENDRECORD (); ``` https://github.com/LibreDWG/libredwg/blob/master/src/out_json.c#L2055
No num_dashes writes to JSON in preR13
https://api.github.com/repos/LibreDWG/libredwg/issues/690/comments
1
2023-04-06T12:56:33Z
2023-04-06T13:46:41Z
https://github.com/LibreDWG/libredwg/issues/690
1,657,379,504
690
[ "LibreDWG", "libredwg" ]
The dwg (and json) contains the entities, blocks, extras offsets and size absolutely in bytes. But when reading from DXF (or changed JSON) we only know the start/end object indices, not the offsets and size. so we need helper functions to find the first BLOCK and last ENDBLK, und use the object index for the API, not the positions and sizes.
change encode_preR13_entities API (again)
https://api.github.com/repos/LibreDWG/libredwg/issues/689/comments
0
2023-04-06T08:59:32Z
2023-04-06T12:50:06Z
https://github.com/LibreDWG/libredwg/issues/689
1,656,962,023
689
[ "LibreDWG", "libredwg" ]
Enable the add API, just not encode.
enable reading preR13 dwg with --disable-write
https://api.github.com/repos/LibreDWG/libredwg/issues/688/comments
0
2023-04-05T06:49:44Z
2023-04-06T12:50:15Z
https://github.com/LibreDWG/libredwg/issues/688
1,655,039,014
688
[ "LibreDWG", "libredwg" ]
When outputting to DXF, floating point values are truncated to 18 characters, which distorts the values of the header variables. I suggest increasing DXF_FLT_MAXLEN.
Trunkated floating value in DXF
https://api.github.com/repos/LibreDWG/libredwg/issues/687/comments
6
2023-04-04T13:46:59Z
2023-04-18T11:18:59Z
https://github.com/LibreDWG/libredwg/issues/687
1,653,929,812
687
[ "LibreDWG", "libredwg" ]
Examples: [test.json.gz](https://github.com/LibreDWG/libredwg/files/11133369/test.json.gz) [test.dwg.gz](https://github.com/LibreDWG/libredwg/files/11133370/test.dwg.gz) I created test.dwg file with CLAYER = 2 (handle r11_idx = 2) and one entity (LINE). I created test.json from this file via dwgread. Output: ```. ... "CLAYER": [0, 0, 0, 0, 2], ... { "entity": "LINE", "index": 8, "type": 1, "size": 36, "layer": [0, 0, 0, 0, 0], "start": [ 0.0, 0.0 ], "end": [ 100.0, 100.0 ] } ... ```` When I want convert this json file to dwg, there is issue with handles. src/in_json.c contain looking for handle via dwg_add_handleref() https://github.com/LibreDWG/libredwg/blob/master/src/dwg.c#L2038 But this function not contain r11_idx, then badly match existing handle. Code ```"layer": [0, 0, 0, 0, 0],``` select same handle as "CLAYER": [0, 0, 0, 0, 2] and rewrite r11_idx to it. In output DWG document will be last entity layer r11_idx. I don't know how to fix right, probably we need add r11_idx to dwg_add_handleref() or create another one function. btw: dwgrewrite is working right
No encoding of handles from JSON to DWG in preR13
https://api.github.com/repos/LibreDWG/libredwg/issues/686/comments
4
2023-04-02T21:18:23Z
2023-04-06T12:51:30Z
https://github.com/LibreDWG/libredwg/issues/686
1,651,098,001
686
[ "LibreDWG", "libredwg" ]
When we convert DWG file to JSON and back via libredwg there is difference in text string. Example: [second.dwg.gz](https://github.com/LibreDWG/libredwg/files/11128606/second.dwg.gz) [first.json.gz](https://github.com/LibreDWG/libredwg/files/11128607/first.json.gz) [first.dwg.gz](https://github.com/LibreDWG/libredwg/files/11128608/first.dwg.gz) Process: * Convert first.dwg to first.json * Convert first.json to second.dwg All seems ok in dwgread: first.dwg ``` Add entity TEXT [8] Decode entity TEXT =========================== Entity number: 8, Type: 7, Addr: 203 layer: 0x1 [H(RSx) 8] ins_pt: (1.000000, 2.000000) [2RD 10] height: 2.375879 [RD 40] oblique_angle: 0.785398 [RD 51] text_value: "Foo" [TV 1] ``` second.dwg ``` Add entity TEXT [8] Decode entity TEXT =========================== Entity number: 8, Type: 7, Addr: 203 layer: 0x1 [H(RSx) 8] ins_pt: (1.000000, 2.000000) [2RD 10] height: 2.375879 [RD 40] oblique_angle: 0.785398 [RD 51] text_value: "Foo" [TV 1] ``` But size of text_value is different. In case of first.dwg is 3, in case of second.dwg is 4 (with \0 string). As i understand issue is in in_json.c, where json string si converted to string with \0 string and bit_write_TV save this \0 string.
Wrong encode text length preR13
https://api.github.com/repos/LibreDWG/libredwg/issues/683/comments
2
2023-04-01T06:29:03Z
2023-04-14T05:58:14Z
https://github.com/LibreDWG/libredwg/issues/683
1,650,326,078
683
[ "LibreDWG", "libredwg" ]
Hello, I was testing my fuzzer and found two bugs in dwg2SVG. ## environment ubuntu 20.04, GCC 9.4.0, libredwg latest commit 9df4ec3c524795a401acf371c8a953f5b1a6fadf compile with ``` ./autogen.sh && ./configure --disable-shared && make -j$(nproc) ``` ##BUG1 ``` ./dwg2SVG ../pocs/poc0.bit_utf8_to_TU ================================================================= ==19712==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000000dc at pc 0x5603ca37f05a bp 0x7fff049b1c90 sp 0x7fff049b1c80 WRITE of size 2 at 0x6020000000dc thread T0 #0 0x5603ca37f059 in bit_utf8_to_TU /libredwg/src/bits.c:2883 #1 0x5603cae6faab in dwg_is_valid_tag /libredwg/src/dwg_api.c:22059 #2 0x5603cae6faab in dwg_is_valid_tag /libredwg/src/dwg_api.c:22048 #3 0x5603ca7744de in dwg_decode_ATTRIB_private /libredwg/src/dwg.spec:204 #4 0x5603ca8fe1ec in dwg_decode_ATTRIB /libredwg/src/dwg.spec:187 #5 0x5603cacaa3a2 in decode_preR13_entities /libredwg/src/decode.c:6520 #6 0x5603cacf559c in decode_preR13 /libredwg/src/decode_r11.c:719 #7 0x5603cac76a6a in dwg_decode /libredwg/src/decode.c:217 #8 0x5603ca362d77 in dwg_read_file /libredwg/src/dwg.c:261 #9 0x5603ca35857c in main /libredwg/programs/dwg2SVG.c:979 #10 0x7fc02854f082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) #11 0x5603ca358c1d in _start (/validate/dwg2SVG/dwg2SVG+0x206c1d) 0x6020000000dc is located 0 bytes to the right of 12-byte region [0x6020000000d0,0x6020000000dc) allocated by thread T0 here: #0 0x7fc028979a06 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:153 #1 0x5603ca37e83a in bit_utf8_to_TU /libredwg/src/bits.c:2856 SUMMARY: AddressSanitizer: heap-buffer-overflow /libredwg/src/bits.c:2883 in bit_utf8_to_TU Shadow bytes around the buggy address: 0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff8000: fa fa 00 00 fa fa 00 fa fa fa 00 fa fa fa 00 00 =>0x0c047fff8010: fa fa 02 fa fa fa 01 fa fa fa 00[04]fa fa fa fa 0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==19712==ABORTING ``` ##BUG2 ``` ./dwg2SVG ../pocs/poc1.bit_wcs2nlen ==19713==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60400000097a at pc 0x55781f6dd09d bp 0x7ffc201cb2e0 sp 0x7ffc201cb2d0 READ of size 2 at 0x60400000097a thread T0 #0 0x55781f6dd09c in bit_wcs2nlen /libredwg/src/bits.c:1834 #1 0x5578201d2abb in dwg_is_valid_tag /libredwg/src/dwg_api.c:22060 #2 0x5578201d2abb in dwg_is_valid_tag /libredwg/src/dwg_api.c:22048 #3 0x55781fad74de in dwg_decode_ATTRIB_private /libredwg/src/dwg.spec:204 #4 0x55781fc611ec in dwg_decode_ATTRIB /libredwg/src/dwg.spec:187 #5 0x55782000d3a2 in decode_preR13_entities /libredwg/src/decode.c:6520 #6 0x55782005859c in decode_preR13 /libredwg/src/decode_r11.c:719 #7 0x55781ffd9a6a in dwg_decode /libredwg/src/decode.c:217 #8 0x55781f6c5d77 in dwg_read_file /libredwg/src/dwg.c:261 #9 0x55781f6bb57c in main /libredwg/programs/dwg2SVG.c:979 #10 0x7faa3dcaf082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) #11 0x55781f6bbc1d in _start (/validate/dwg2SVG/dwg2SVG+0x206c1d) 0x60400000097a is located 0 bytes to the right of 42-byte region [0x604000000950,0x60400000097a) allocated by thread T0 here: #0 0x7faa3e0d9a06 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:153 #1 0x55781f6e183a in bit_utf8_to_TU /libredwg/src/bits.c:2856 SUMMARY: AddressSanitizer: heap-buffer-overflow /libredwg/src/bits.c:1834 in bit_wcs2nlen Shadow bytes around the buggy address: 0x0c087fff80d0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff80e0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff80f0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff8100: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 fa 0x0c087fff8110: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 =>0x0c087fff8120: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00[02] 0x0c087fff8130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8150: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8160: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff8170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==19713==ABORTING ``` ## POC [poc.zip](https://github.com/LibreDWG/libredwg/files/11118078/poc.zip) ## Credit Han Zheng (Hexhive, NCNIPC of China)
[FUZZ] two bugs in dwg2SVG
https://api.github.com/repos/LibreDWG/libredwg/issues/681/comments
3
2023-03-31T04:10:48Z
2023-03-31T13:37:12Z
https://github.com/LibreDWG/libredwg/issues/681
1,648,637,134
681
[ "LibreDWG", "libredwg" ]
There are many interpretation of handles in libredwg JSON. I see in JSON: in dwgread: 0.1.1 [H 5] ``` "handle": [0, 2], ``` and in dwgread: (4.0.0) abs:0 [H 0] ``` "ownerhandle": [4, 0, 0, 0, 0], ``` and In preR13 is index to some table which is BITCODE_H too. There is no serialization to JSON for this type. What is the right approach to store them?
How handles are interpreted in libredwg JSON?
https://api.github.com/repos/LibreDWG/libredwg/issues/678/comments
3
2023-03-30T06:33:13Z
2023-04-02T09:51:25Z
https://github.com/LibreDWG/libredwg/issues/678
1,647,000,507
678
[ "LibreDWG", "libredwg" ]
Hello, I was testing my fuzzer and found two bugs in dwg2dxf, which is different from #368 and #484 ## environment ubuntu 20.04, GCC 9.4.0, libredwg latest commit 77a85621de6e2c7ea44bc48c02e52dac97778ecb compile with ``` ./autogen.sh && ./configure --disable-shared && make -j$(nproc) ``` ## BUG1 ``` /libredwg/programs/dwg2dxf /pocs/pocs/dwg2dxf/poc0.bit_calc_CRC Reading DWG file /pocs/pocs/dwg2dxf/poc0.bit_calc_CRC ERROR: Header CRC mismatch 0003 <=> 3C16 Warning: @0x3d7 => start 0x3c5 ERROR: DWG_SENTINEL_R11_ENTITIES_BEGIN mismatch ERROR: DWG_SENTINEL_R11_ENTITIES_END mismatch .... AddressSanitizer:DEADLYSIGNAL ================================================================= ==78==ERROR: AddressSanitizer: SEGV on unknown address 0x62100a3d71b3 (pc 0x563f38494cff bp 0x7ffd51ea1fa8 sp 0x7ffd51ea09e0 T0) ==78==The signal is caused by a READ memory access. #0 0x563f38494cfe in bit_calc_CRC /libredwg/src/bits.c:3456 #1 0x563f38db6295 in decode_preR13_auxheader /libredwg/src/decode.c:6278 #2 0x563f38e0736a in decode_preR13 /libredwg/src/decode_r11.c:786 #3 0x563f38d8532a in dwg_decode /libredwg/src/decode.c:217 #4 0x563f38472a67 in dwg_read_file /libredwg/src/dwg.c:261 #5 0x563f38470c9c in main /libredwg/programs/dwg2dxf.c:261 #6 0x7efdc3332082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) #7 0x563f3847153d in _start (/libredwg/programs/dwg2dxf+0x23a53d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /libredwg/src/bits.c:3456 in bit_calc_CRC ==78==ABORTING ``` ## BUG2 ``` /libredwg/programs/dwg2dxf -y /pocs/pocs/dwg2dxf/poc1.bit_write_TF Reading DWG file /pocs/pocs/dwg2dxf/poc1.bit_write_TF Warning: Invalid sections: 0 != numgaps: 0 + numsections: 26 ERROR: Invalid .props x 33456 ERROR: bit_read_RC buffer overflow at 1704.1 + 0 > 1704 Warning: Unstable Class entity 504 WIPEOUT (0x87f) 111/0 Warning: Unstable Class object 506 MATERIAL (0x481) 114/0 Warning: Unstable Class object 506 MATERIAL (0x481) 122/0 Warning: Unstable Class object 506 MATERIAL (0x481) 130/0 Warning: Unstable Class object 508 TABLESTYLE (0xfff) 164/0 ERROR: Invalid bitsize 445692418 > 1536 ... ================================================================= ==83==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62500000228f at pc 0x5567bafe7bf1 bp 0x7ffc90495880 sp 0x7ffc90495870 READ of size 1 at 0x62500000228f thread T0 #0 0x5567bafe7bf0 in bit_write_TF /libredwg/src/bits.c:1675 #1 0x5567bbb416b4 in dwg_convert_SAB_to_SAT1 /libredwg/src/out_dxf.c:2150 #2 0x5567bbbb2164 in dxf_3dsolid /libredwg/src/out_dxf.c:2398 #3 0x5567bbbb2164 in dwg_dxf_REGION_private /libredwg/src/dwg.spec:2990 #4 0x5567bbc6acbe in dwg_dxf__3DSOLID /libredwg/src/dwg.spec:2994 #5 0x5567bbc6acbe in dwg_dxf_object /libredwg/src/out_dxf.c:2774 #6 0x5567bbc9ab52 in dxf_entities_write /libredwg/src/out_dxf.c:3635 #7 0x5567bbc9ab52 in dwg_write_dxf /libredwg/src/out_dxf.c:3796 #8 0x5567bafc5ce8 in main /libredwg/programs/dwg2dxf.c:339 #9 0x7f5740a12082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) #10 0x5567bafc653d in _start (/libredwg/programs/dwg2dxf+0x23a53d) 0x62500000228f is located 0 bytes to the right of 8591-byte region [0x625000000100,0x62500000228f) allocated by thread T0 here: #0 0x7f5740e3ca06 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:153 #1 0x5567bb00fa85 in decode_3dsolid /libredwg/src/dwg.spec:2706 #2 0x21c6 (<unknown module>) SUMMARY: AddressSanitizer: heap-buffer-overflow /libredwg/src/bits.c:1675 in bit_write_TF Shadow bytes around the buggy address: 0x0c4a7fff8400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c4a7fff8410: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c4a7fff8420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c4a7fff8430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c4a7fff8440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c4a7fff8450: 00[07]fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4a7fff8460: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4a7fff8470: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4a7fff8480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4a7fff8490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4a7fff84a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==83==ABORTING ``` ## POC [poc.zip](https://github.com/LibreDWG/libredwg/files/11107648/poc.zip) ## Credit Han Zheng (NCNIPC of China, Hexhive)
[FUZZ] two bugs in dwg2dxf
https://api.github.com/repos/LibreDWG/libredwg/issues/677/comments
2
2023-03-30T04:10:56Z
2023-04-04T14:03:23Z
https://github.com/LibreDWG/libredwg/issues/677
1,646,878,719
677
[ "LibreDWG", "libredwg" ]
There is issue in conversion from JSON to DWG. Example: [test.json.gz](https://github.com/LibreDWG/libredwg/files/11104873/test.json.gz) When i convert this JSON file via: ``` dwgwrite test.json ``` there is error: ``` Warning: Unknown key HEADER.layer_colors ``` which means no conversion to DWG. Main problem is with https://github.com/LibreDWG/libredwg/blob/master/src/in_json.c#L1076 which was not found item. I don't understand what I need to fix. As I understand there is no match of ```layer_colors[128]``` and ```layer_colors```
layer_colors issue with conversion from JSON (AC1.40) to DWG (AC1.40)
https://api.github.com/repos/LibreDWG/libredwg/issues/676/comments
4
2023-03-29T19:43:15Z
2023-03-30T14:33:43Z
https://github.com/LibreDWG/libredwg/issues/676
1,646,408,341
676
[ "LibreDWG", "libredwg" ]
There are DIMMALTZ and DIMALTZ variables in the header and the DIMSTYLE object. These values are the same, the conversion of AC1012 DIMALTZ = 1 to DXF is bad (0).
DIMMALTZ and DIMALTZ need to be merged
https://api.github.com/repos/LibreDWG/libredwg/issues/672/comments
3
2023-03-24T09:17:55Z
2023-03-24T13:27:33Z
https://github.com/LibreDWG/libredwg/issues/672
1,639,015,027
672
[ "LibreDWG", "libredwg" ]
How can I compile this library as a dynamic so file that can be used for Android?thanks
How can I compile this library as a dynamic so file that can be used for Android?
https://api.github.com/repos/LibreDWG/libredwg/issues/671/comments
2
2023-03-22T02:53:34Z
2023-03-30T10:21:42Z
https://github.com/LibreDWG/libredwg/issues/671
1,634,973,504
671
[ "LibreDWG", "libredwg" ]
Hi, I have attached three files. one original DWG file and two dxf files one created using libreDWG and other using AutoCAD. The file created using libredwg is not having all information, some information are missing. [test.zip](https://github.com/LibreDWG/libredwg/files/11014459/test.zip)
To DXF is not converting all informations (AME)
https://api.github.com/repos/LibreDWG/libredwg/issues/666/comments
7
2023-03-20T05:33:39Z
2023-04-01T06:41:52Z
https://github.com/LibreDWG/libredwg/issues/666
1,631,418,807
666
[ "LibreDWG", "libredwg" ]
Hello, While trying to read the arrowheads of dimensions I encountered some problems. I have created various .dwg files just for testing purposes, each one has different arrowheads: You can find them inside the attached file [test.zip](https://github.com/LibreDWG/libredwg/files/11003424/test.zip). For example: - ah_dot_dot has a Dot arrowhead on the left and on the right, - ah_dot_oblique has a Dot arrowhead on the left and an Oblique arrowhead on the right - ... First, if there is an Oblique arrowhead the generated .json file is **blank**. I mean, the .json file is generated, but without any entities/tables. Adding the -v9 argument shows many errors. Second, looking at the DXF reference, the left arrowhead and the right arrowhead handles should be stored within the associated DIMSTYLE, in the **DIMBLK1 and DIMBLK2** fields, respectively. But they are **empty** every time, is this normal? (I could be wrong here, they might be stored only if an override is happening, but I'm not sure) Thanks, Dave
Problems with dimension arrowheads
https://api.github.com/repos/LibreDWG/libredwg/issues/663/comments
7
2023-03-17T16:15:39Z
2023-03-26T09:50:19Z
https://github.com/LibreDWG/libredwg/issues/663
1,629,581,270
663
[ "LibreDWG", "libredwg" ]
Hello, Please consider the attached file [test.zip](https://github.com/LibreDWG/libredwg/files/10999915/test.zip) First, I tried to read a DWG file using dwgread.exe with the following command (powershell): `.\libredwg-0.12.5-win64\dwgread.exe -o .\PressEdited.json .\PressEdited.dwg` This successfully generated a .json file. Then, I tried to write the .json content again into a DWG file with the following command: `.\libredwg-0.12.5-win64\dwgwrite.exe -o .\PressTest.dwg .\PressEdited.json 2>&1 > outputEdited.txt` This generates a lot of **errors** and **doesn't write any DWG file**. You can find the output inside the file: outputEdited.txt. The file doesn't seem to be corrupted as I can view/save it using AUTOCAD2007. Is it a bug or a corrupted file? If it's a corrupted file, is it possible to fix these errors myself (without changing the dwg version)? Thanks, Dave
ERROR: bit_read_UMC: error parsing modular char, i=-1,j=42,result=0x1112e4a7652
https://api.github.com/repos/LibreDWG/libredwg/issues/662/comments
4
2023-03-17T09:58:28Z
2023-04-15T17:09:38Z
https://github.com/LibreDWG/libredwg/issues/662
1,629,025,171
662
[ "LibreDWG", "libredwg" ]
Hello, I have a question, I'm trying to read an OrdinateDim entity _(attached file OrdinateDim.zip)_ but it's not very clear to me how to get the final text position. Please take a look at the image below: ![image](https://user-images.githubusercontent.com/38076337/224994049-a84905c9-4b59-46fc-ba70-f13167551f95.png) Do you have any suggestions on how to get from the text position values in the json file (243.75, -79.66) to the ones that I should see when I render the entity (84.47, 243.74) ? Thank you [OrdinateDim.zip](https://github.com/LibreDWG/libredwg/files/10967956/OrdinateDim.zip)
How to read OrdinateDim text position
https://api.github.com/repos/LibreDWG/libredwg/issues/660/comments
2
2023-03-14T12:47:56Z
2023-03-17T11:05:40Z
https://github.com/LibreDWG/libredwg/issues/660
1,623,410,828
660
[ "LibreDWG", "libredwg" ]
Hello, Please consider the attached file 2.dwg. There is an LWPolyline entity with handle **1019** that should be closed. By looking at the [dxf group codes docs](http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-79fc.htm) I see that the closed flag value of a LWPolyline is 1 (bit-coded), and the other possible flag values are 0 and 128. But looking at the json file the flag value is 528, 001000010000. See below. ![image](https://user-images.githubusercontent.com/38076337/224365865-a72605ce-a9b7-4912-b22d-ed9338041517.png) I am aware that this is not a dxf file and that the flag value might differ, but the [OpenDesign Specification](https://www.opendesign.com/files/guestdownloads/OpenDesign_Specification_for_.dwg_files.pdf) is not helping much. I did a few tests and the 512 bit seems to be the right flag value for a closed LWPolyline in this case, is this ok? Should I just keep that as the right value or am I missing something? Thank you. [2.zip](https://github.com/LibreDWG/libredwg/files/10943763/2.zip)
LWPolyline closed flag
https://api.github.com/repos/LibreDWG/libredwg/issues/658/comments
3
2023-03-10T16:11:26Z
2023-03-14T09:26:50Z
https://github.com/LibreDWG/libredwg/issues/658
1,619,224,348
658
[ "LibreDWG", "libredwg" ]
Hello, This DWG file generates a 0x941 error during reading. [error_0x941.zip](https://github.com/LibreDWG/libredwg/files/10941272/error_0x941.zip)
Crash during DWG read
https://api.github.com/repos/LibreDWG/libredwg/issues/657/comments
5
2023-03-10T10:52:49Z
2023-03-31T15:02:26Z
https://github.com/LibreDWG/libredwg/issues/657
1,618,780,187
657
[ "LibreDWG", "libredwg" ]
Hello, I'm trying to read a dwg file "3.dwg" _(see attachment below 3.zip)_. I think there is an error in the leader entity: The Leader entity with handle **117** should have an hookline, see image below: ![image](https://user-images.githubusercontent.com/38076337/224086761-81e857b6-0f39-4d9f-951d-36afecdf7dec.png) Supposing I'm using the right flag "**hookline_on**", in this case it should be true. In this file example there are also other Leader entities which should have an hookline, but the flag "**hookline_on**" is always false. Are there other ways to retrieve the hookline flag correctly? Is it a bug? Thank you. [3.zip](https://github.com/LibreDWG/libredwg/files/10933725/3.zip)
Leader entities hookline flag
https://api.github.com/repos/LibreDWG/libredwg/issues/656/comments
10
2023-03-09T16:30:58Z
2023-09-21T20:05:56Z
https://github.com/LibreDWG/libredwg/issues/656
1,617,581,345
656
[ "LibreDWG", "libredwg" ]
Hello, I'm trying to read a dwg file "2.dwg" _(see attachment below 2.zip)_. I have a problem in a text entity: The Text entity with handle **890** should have the following text_value: "**20ƒ10/18 l=420 (alt)**" But, if you look at the json file the 'ƒ' character is missing. Please look at the image below. ![image](https://user-images.githubusercontent.com/38076337/224029914-af7123f2-5ccc-495b-b536-007838df4332.png) Searching in online tables I found that the 'ƒ' character should be the unicode **"\u0192"**, but here I'm getting the unicode **"\u0083"**. It is not very clear to me how and if I can **convert these values**, do you have any suggestions? [2.zip](https://github.com/LibreDWG/libredwg/files/10931599/2.zip)
Still NATIVE_WCHAR2 failures. Fixed: Unicode characters in Text entities (unsupported <r2007 codepages, like ANSI_1254)
https://api.github.com/repos/LibreDWG/libredwg/issues/655/comments
12
2023-03-09T13:06:12Z
2024-03-11T18:41:20Z
https://github.com/LibreDWG/libredwg/issues/655
1,617,210,604
655
[ "LibreDWG", "libredwg" ]
# Can we package the code to vcpkg? - [vcpkg](https://github.com/microsoft/vcpkg) - [package a lib](https://learn.microsoft.com/zh-cn/vcpkg/) # Are there any guidelines or permits I should follow?
memmem issue on Apple's 10.6 SDK (was: Package the code to vcpkg)
https://api.github.com/repos/LibreDWG/libredwg/issues/652/comments
8
2023-03-02T03:01:38Z
2023-08-04T05:26:24Z
https://github.com/LibreDWG/libredwg/issues/652
1,606,026,336
652
[ "LibreDWG", "libredwg" ]
hi, I tried to compile the lib in centos 7.0, unfortunately it failed. The error message is below, can anyone have any idea about it? Thanks. $sh ./autogen.sh + rm -rf autom4te.cache config.status + test -d .git -a -f build-aux/git-version-gen + git fetch --tags + rm .tarball-version ++ build-aux/git-version-gen .tarball-version + v=0.12.5.5135_dirty + echo 0.12.5.5135_dirty + echo 0.12.5.5135_dirty + set -e + autoreconf --install --symlink -I m4 aclocal: error: aclocal: file 'm4/lt~obsolete.m4' does not exist autoreconf: aclocal failed with exit status: 1 $automake --version automake (GNU automake) 1.14 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Tom Tromey <[email protected]> and Alexandre Duret-Lutz <[email protected]>. $m4 --version m4 (GNU M4) 1.4.16 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Rene' Seindal.
configure failed in centos 7.0
https://api.github.com/repos/LibreDWG/libredwg/issues/649/comments
10
2023-02-28T03:52:10Z
2023-03-03T02:26:25Z
https://github.com/LibreDWG/libredwg/issues/649
1,602,321,803
649
[ "LibreDWG", "libredwg" ]
Hello, I find it difficult to compare hatch pattern JSON data with actual AutoCAD hatch pattern values, is there something I need to know to properly interpret these values? In particular, the `origin` and `offset` doesn't sum up... I've also checked [this article](https://knowledge.autodesk.com/support/autocad-lt/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-LT/files/GUID-A6F2E6FF-1717-44B6-A476-0CA817ADD77E-htm.html) without succeding. Thank you. ![image](https://user-images.githubusercontent.com/79898585/221507913-a671fb7c-c9ce-40a0-a2f8-abf3cb370a01.png)
Hatch Pattern data different from AutoCAD one
https://api.github.com/repos/LibreDWG/libredwg/issues/648/comments
3
2023-02-27T09:02:48Z
2023-03-17T13:07:27Z
https://github.com/LibreDWG/libredwg/issues/648
1,600,758,509
648
[ "LibreDWG", "libredwg" ]
As we can cross-compile via clang-cl and have a proper CI, and the work is not that much. cmake only, no project files. cmake can generate them if needed.
VS2019 support via cmake
https://api.github.com/repos/LibreDWG/libredwg/issues/647/comments
1
2023-02-17T11:20:55Z
2023-03-01T12:58:14Z
https://github.com/LibreDWG/libredwg/issues/647
1,589,204,422
647
[ "LibreDWG", "libredwg" ]
vs2019 link with libredwg-0.12.5.5140-win64 Dwg_Data* pDoc = dwg_new_Document(R_2000, 0, 0); Dwg_Object* poMSpace = dwg_model_space_object(pDoc); Dwg_Object_BLOCK_HEADER* pMSpace = poMSpace->tio.object->tio.BLOCK_HEADER; dwg_point_3d start = { 0 }; dwg_point_3d end = { 0 }; dwg_add_LINE(pMSpace, &start, &end); dwg_free_Document(pDoc); dwg_free(pDoc); free(pDoc); will crash remove free(pDoc); will cause memory leak. So we need to do memory isolation ?
Memory management isolation
https://api.github.com/repos/LibreDWG/libredwg/issues/646/comments
4
2023-02-15T14:58:05Z
2023-02-17T10:27:51Z
https://github.com/LibreDWG/libredwg/issues/646
1,586,006,193
646
[ "LibreDWG", "libredwg" ]
null
add clang-tidy support
https://api.github.com/repos/LibreDWG/libredwg/issues/645/comments
0
2023-02-15T12:13:00Z
2023-02-17T11:18:54Z
https://github.com/LibreDWG/libredwg/issues/645
1,585,753,328
645
[ "LibreDWG", "libredwg" ]
- _obj->TDCREATE {days=2454762 ms=99310234 value=2454762.9931023400 } _dwg_time_bll days 2454762 unsigned int ms 99310234 unsigned int value 2454762.9931023400 double - tm {tm_sec=10 tm_min=35 tm_hour=27 ...} tm tm_sec 10 int tm_min 35 int tm_hour 27 int tm_mday 22 int tm_mon 9 int tm_year 108 int tm_hour = 27 is invalid
BUG of cvt_TIMEBLL
https://api.github.com/repos/LibreDWG/libredwg/issues/639/comments
5
2023-02-13T02:21:21Z
2023-02-17T11:19:44Z
https://github.com/LibreDWG/libredwg/issues/639
1,581,530,058
639
[ "LibreDWG", "libredwg" ]
The performance of generating large files is too poor. There are several optional optimization steps: 1. find_prev_Entity can add a prev_ Index points to the last added entity object so that it does not need to reverse lookup 2. dwg_add_Handleref uses binary search to replace linear search. Currently, the time for 9M dwg files has been reduced from more than 1000 seconds to more than 60 seconds
Performance of find_prev_Entity/dwg_add_Handleref
https://api.github.com/repos/LibreDWG/libredwg/issues/638/comments
2
2023-02-12T12:10:24Z
2023-03-01T12:58:53Z
https://github.com/LibreDWG/libredwg/issues/638
1,581,234,786
638
[ "LibreDWG", "libredwg" ]
into MENU and MENUEXT. stored in JSON as MENU only
MENUEXT: split on import or version downgrade
https://api.github.com/repos/LibreDWG/libredwg/issues/636/comments
1
2023-02-10T06:08:57Z
2023-04-14T05:58:34Z
https://github.com/LibreDWG/libredwg/issues/636
1,579,047,972
636
[ "LibreDWG", "libredwg" ]
We need to fix the extra entity section. This is not a classic entity section. Example: [PL1.DXF.gz](https://github.com/LibreDWG/libredwg/files/10702438/PL1.DXF.gz) [PL1.DWG.gz](https://github.com/LibreDWG/libredwg/files/10702439/PL1.DWG.gz) Actual output: ``` extra entities: (0x932-0x943 (0), size 17) ========================================== type: 19 [RCd] Add entity POLYLINE_2D [23] Decode entity POLYLINE_2D =========================== Entity number: 23, Type: 19, Addr: 932 flag_r11: 0x80 [RC 0] HAS_ATTRIBS(0x80) size: 9 [RS] layer: 0 [H(RSd) 8] opts_r11: 0x1 [RSx 0] HAS_FLAG(0x1) flag: 0x1 [RC 70] CLOSED(0x1) type: 18 [RCd] Add entity POLYLINE_2D [24] Decode entity POLYLINE_2D =========================== Entity number: 24, Type: 18, Addr: 93b flag_r11: 0x0 [RC 0] size: 8 [RS] layer: 1306 [H(RSd) 8] opts_r11: 0x0 [RSx 0] ========================================== extra entities: end ``` The second item isn't an entity, but extra information for replacement. Every time is 8 bytes in length.
Fix extra entity section in preR13
https://api.github.com/repos/LibreDWG/libredwg/issues/635/comments
8
2023-02-09T23:43:29Z
2023-04-18T11:20:03Z
https://github.com/LibreDWG/libredwg/issues/635
1,578,773,702
635
[ "LibreDWG", "libredwg" ]
We need to fix AUX header in R11 Prepared commit: https://github.com/michal-josef-spacek/libredwg/commit/dcbe8080d9b815c810e5140210652453302b0176 Possible to commit after https://github.com/LibreDWG/libredwg/pull/630 and https://github.com/LibreDWG/libredwg/pull/631
Fix AUX header in R11
https://api.github.com/repos/LibreDWG/libredwg/issues/632/comments
12
2023-02-08T17:20:50Z
2023-02-09T18:40:11Z
https://github.com/LibreDWG/libredwg/issues/632
1,576,515,447
632
[ "LibreDWG", "libredwg" ]
We have 3 entity sections in preR13 This issue is about fixing them.
Fix entity sections in preR13
https://api.github.com/repos/LibreDWG/libredwg/issues/629/comments
2
2023-02-08T00:38:11Z
2023-02-09T14:04:38Z
https://github.com/LibreDWG/libredwg/issues/629
1,575,253,214
629
[ "LibreDWG", "libredwg" ]
attdef and atrib tag is one word and R13 (tested on R14) supports utf8 string for it. dwgadd don't encode utf8 string in case of tag actually.
dwgadd: Fix attdef and attrib tag for releases which could use utf8
https://api.github.com/repos/LibreDWG/libredwg/issues/628/comments
7
2023-02-02T10:29:30Z
2023-02-06T15:56:48Z
https://github.com/LibreDWG/libredwg/issues/628
1,567,771,059
628
[ "LibreDWG", "libredwg" ]
Example: [MENU1.DXF.gz](https://github.com/LibreDWG/libredwg/files/10567704/MENU1.DXF.gz) [MENU1.DWG.gz](https://github.com/LibreDWG/libredwg/files/10567705/MENU1.DWG.gz) In example is longest menu path, which could be. ```C:\ABCDEFG\HIJKLMNO\PQRSTUVW\XYZABCDE\FGHIJKLM\NOPQRS\ACAD``` First part is existing menu. Second part is unknown_46 - 45 characters + null string
Identify second part of $MENU header variable
https://api.github.com/repos/LibreDWG/libredwg/issues/626/comments
3
2023-02-02T10:14:23Z
2023-02-03T11:37:06Z
https://github.com/LibreDWG/libredwg/issues/626
1,567,744,437
626
[ "LibreDWG", "libredwg" ]
There is ```dwg_add_ATTRIB```, ```dwg_add_ATTDEF``` internal functions and public ```dwg_add_Atribute``` which works on insert. This is not ok. ```ATTDEF``` is a regular entity that could be in entities as is. ```ATTDEF``` entity could be used in block, this is a sense of this entity. In this case, it is moving to block (between ```BLOCK``` and ```ENDBLK``` entities). ```ATTRIB``` is an entity which is every time in insert sequence (between ```INSERT``` and ```SEQEND``` entities).
Fix attdef and attrib concept
https://api.github.com/repos/LibreDWG/libredwg/issues/619/comments
7
2023-01-31T12:16:47Z
2023-02-01T12:21:47Z
https://github.com/LibreDWG/libredwg/issues/619
1,564,199,502
619
[ "LibreDWG", "libredwg" ]
some r2004 dwg's have invalid section_map_address (as well as last_section_address and second_header_address), overflowing the stream. e.g. to/2004/1/1344464555.dwg of size 0x3d6e00, with section_map_address: 0xc16f00. we know that the section type magic 0x41630e3b must appear at a 0x20 page boundary. ODA fails with "Unexpected end of file", so failing looks ok
search for the Section Page Map backwards
https://api.github.com/repos/LibreDWG/libredwg/issues/617/comments
0
2023-01-31T07:26:25Z
2023-02-01T12:21:57Z
https://github.com/LibreDWG/libredwg/issues/617
1,563,798,827
617
[ "LibreDWG", "libredwg" ]
# Description heap-buffer-overflow in function decode_preR13_section_chk at decode_r11.c:225 # Version ``` git log commit d11e3c5b1c003174072732e1b2276b793af5dac8 (HEAD -> master, tag: 0.12.5.5028, origin/smoke/some_mc0_support, origin/master, origin/HEAD) Author: Reini Urban <[email protected]> Date: Mon Jan 30 08:59:21 2023 +0100 ``` # Steps to reproduce ``` apt install jing libjaxp1.3-java libbatik-java libavalon-framework-java git clone https://github.com/LibreDWG/libredwg.git export CFLAGS="-g -O0 -lpthread -fsanitize=address" export CXXFLAGS="-g -O0 -lpthread -fsanitize=address" export LDFLAGS="-fsanitize=address" cd libredwg sh ./autogen.sh ./configure --enable-release --enable-trace --disable-shared make -j ``` ``` cd programs ./dwg2dxf -b -m ./poc_hbo02.bin -o /dev/null Reading DWG file ./poc_hbo02.bin ================================================================= ==1717723==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x618000000404 at pc 0x000000a6e9ce bp 0x7fffffffbb60 sp 0x7fffffffbb58 READ of size 4 at 0x618000000404 thread T0 #0 0xa6e9cd in decode_preR13_section_chk /home/fuzz/libredwg/src/decode_r11.c:225:3 #1 0xa4386e in decode_preR13 /home/fuzz/libredwg/src/decode_r11.c:966:7 #2 0x515eae in dwg_decode /home/fuzz/libredwg/src/decode.c:217:17 #3 0x4ce9c3 in dwg_read_file /home/fuzz/libredwg/src/dwg.c:255:11 #4 0x4cb903 in main /home/fuzz/libredwg/programs/dwg2dxf.c:258:15 #5 0x7ffff7c49082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 #6 0x41d4bd in _start (/home/fuzz/libredwg/programs/dwg2dxf+0x41d4bd) 0x618000000404 is located 4 bytes to the right of 896-byte region [0x618000000080,0x618000000400) allocated by thread T0 here: #0 0x498892 in calloc (/home/fuzz/libredwg/programs/dwg2dxf+0x498892) #1 0x4efea5 in dwg_sections_init /home/fuzz/libredwg/src/dwg.c:3123:42 #2 0xd1ac10 in dwg_add_Document /home/fuzz/libredwg/src/dwg_api.c:22109:11 #3 0xa4002e in decode_preR13 /home/fuzz/libredwg/src/decode_r11.c:721:12 #4 0x515eae in dwg_decode /home/fuzz/libredwg/src/decode.c:217:17 #5 0x4ce9c3 in dwg_read_file /home/fuzz/libredwg/src/dwg.c:255:11 #6 0x4cb903 in main /home/fuzz/libredwg/programs/dwg2dxf.c:258:15 #7 0x7ffff7c49082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fuzz/libredwg/src/decode_r11.c:225:3 in decode_preR13_section_chk Shadow bytes around the buggy address: 0x0c307fff8030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c307fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c307fff8050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c307fff8060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c307fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c307fff8080:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==1717723==ABORTING ``` # POC [poc_hbo02.bin](https://github.com/JieyongMa/poc/raw/main/libredwg/poc_hbo02.bin) # Impact This vulnerability is capable of crashing software, bypass protection mechanism, modify of memory, and successful exploitation may lead to code execution.
heap-buffer-overflow in function decode_preR13_section_chk at decode_r11.c:225
https://api.github.com/repos/LibreDWG/libredwg/issues/616/comments
0
2023-01-31T01:03:36Z
2023-01-31T06:27:36Z
https://github.com/LibreDWG/libredwg/issues/616
1,563,448,873
616
[ "LibreDWG", "libredwg" ]
# Description heap-buffer-overflow in function bit_read_RC at bits.c:320 # Version ``` git log commit 3c90dc6641e11e486666940d7f354d2df54503d6 (HEAD -> master, tag: 0.12.5.5010, origin/master, origin/HEAD) Author: Michal Josef Špaček <[email protected]> Date: Fri Jan 27 18:50:08 2023 +0100 ``` # Steps to reproduce ``` apt install jing libjaxp1.3-java libbatik-java libavalon-framework-java git clone https://github.com/LibreDWG/libredwg.git export CFLAGS="-g -O0 -lpthread -fsanitize=address" export CXXFLAGS="-g -O0 -lpthread -fsanitize=address" export LDFLAGS="-fsanitize=address" cd libredwg sh ./autogen.sh ./configure --enable-release --enable-trace --disable-shared make -j ``` ``` cd programs ./dwg2dxf -b -m ./poc_hbo01.bin -o /dev/null Reading DWG file ./poc_hbo01.bin ================================================================= ==3322912==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61700000007f at pc 0x0000004f4ebf bp 0x7fffffffaca0 sp 0x7fffffffac98 READ of size 1 at 0x61700000007f thread T0 #0 0x4f4ebe in bit_read_RC /home/fuzz/libredwg/src/bits.c:320:10 #1 0x4f5b15 in bit_read_RS /home/fuzz/libredwg/src/bits.c:380:11 #2 0x4f6155 in bit_read_RL /home/fuzz/libredwg/src/bits.c:443:11 #3 0x51d38f in decode_R13_R2000 /home/fuzz/libredwg/src/decode.c:682:9 #4 0x515806 in dwg_decode /home/fuzz/libredwg/src/decode.c:225:38 #5 0x4ce9c3 in dwg_read_file /home/fuzz/libredwg/src/dwg.c:255:11 #6 0x4cb903 in main /home/fuzz/libredwg/programs/dwg2dxf.c:258:15 #7 0x7ffff7c49082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 #8 0x41d4bd in _start (/home/fuzz/libredwg/programs/dwg2dxf+0x41d4bd) 0x61700000007f is located 1 bytes to the left of 652-byte region [0x617000000080,0x61700000030c) allocated by thread T0 here: #0 0x498892 in calloc (/home/fuzz/libredwg/programs/dwg2dxf+0x498892) #1 0x4ccfc7 in dat_read_file /home/fuzz/libredwg/src/dwg.c:91:33 #2 0x4ce911 in dwg_read_file /home/fuzz/libredwg/src/dwg.c:248:15 #3 0x4cb903 in main /home/fuzz/libredwg/programs/dwg2dxf.c:258:15 #4 0x7ffff7c49082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fuzz/libredwg/src/bits.c:320:10 in bit_read_RC Shadow bytes around the buggy address: 0x0c2e7fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2e7fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2e7fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2e7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2e7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c2e7fff8000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa] 0x0c2e7fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2e7fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2e7fff8030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2e7fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2e7fff8050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==3322912==ABORTING ``` # POC [poc_hbo01.bin](https://github.com/JieyongMa/poc/raw/main/libredwg/poc_hbo01.bin) # Impact This vulnerability is capable of crashing software, bypass protection mechanism, modify of memory, and successful exploitation may lead to code execution.
heap-buffer-overflow in function bit_read_RC at bits.c:320
https://api.github.com/repos/LibreDWG/libredwg/issues/615/comments
1
2023-01-30T08:00:12Z
2023-04-29T20:50:44Z
https://github.com/LibreDWG/libredwg/issues/615
1,561,928,009
615
[ "LibreDWG", "libredwg" ]
There is another issue with: ``` else if (SSCANF_S (p, #var "." FMT_NAME " = %lf", &s1[0] SZ, &f1)) \ { \ if (!ent.u.var || ent.type != DWG_TYPE_##name) \ fn_error ("Invalid type " #var ". Empty or wrong type\n"); \ dwg_dynapi_entity_set_value (ent.u.var, #name, s1, &f1, 0); \ } ``` Some variables like oblique_angle are in degrees (float), so we need to convert to radians.
dwgadd issue with variable converting to radians
https://api.github.com/repos/LibreDWG/libredwg/issues/611/comments
2
2023-01-28T10:49:58Z
2023-02-02T08:33:08Z
https://github.com/LibreDWG/libredwg/issues/611
1,560,814,827
611
[ "LibreDWG", "libredwg" ]
When I have dwgadd input: ``` text "baz" (1 2 3) 8 text.oblique_angle = 45.0 ``` Parsing of entity not working. Code of: ``` #define SET_ENT(var, name) \ if (SSCANF_S (p, #var "." FMT_NAME " = %d.%d.%X", &s1[0] SZ, &i1, &i2, &u)) \ { \ BITCODE_H hdl; \ if (!ent.u.var || ent.type != DWG_TYPE_##name) \ fn_error ("Invalid type " #var ". Empty or wrong type\n"); \ hdl = dwg_add_handleref (dwg, i1, u, NULL); \ dwg_dynapi_entity_set_value (ent.u.var, #name, s1, hdl, 0); \ } ... ``` which is for parsing of the handle will be used instead of the right parse of float.
dwgadd issue with parsing of entity field (entity.field)
https://api.github.com/repos/LibreDWG/libredwg/issues/610/comments
2
2023-01-28T06:19:59Z
2023-02-02T08:33:07Z
https://github.com/LibreDWG/libredwg/issues/610
1,560,716,065
610
[ "LibreDWG", "libredwg" ]
When I use ```dwgadd``` for text entity, it doesn't work. All floats after the text string are 0.00000. When I change FMT_ANY to FMT_TBL, everything is working.
dwgadd issue with text entity (bad FMT_ANY)
https://api.github.com/repos/LibreDWG/libredwg/issues/609/comments
1
2023-01-27T18:32:55Z
2023-02-02T08:33:06Z
https://github.com/LibreDWG/libredwg/issues/609
1,560,223,391
609
[ "LibreDWG", "libredwg" ]
There are no logging messages when I compile code which is using dwg.c. Logging from encode.c is on the place. When I am looking to encode.c and dwg.c files, they are similar. Both have: ``` /* The logging level per .o */ static unsigned int loglevel; #ifdef USE_TRACING /* This flag means we have checked the environment variable LIBREDWG_TRACE and set `loglevel' appropriately. */ static bool env_var_checked_p; #endif /* USE_TRACING */ #define DWG_LOGLEVEL loglevel #include "logging.h" ``` I don't know what happened. Example: [ex9.c.gz](https://github.com/LibreDWG/libredwg/files/10518407/ex9.c.gz) Compile by: ``` gcc -std=c99 -Wall `pkg-config --cflags libredwg` -o ex9 ex9.c `pkg-config --libs libredwg` ```
Issue with logging in dwg.c
https://api.github.com/repos/LibreDWG/libredwg/issues/607/comments
2
2023-01-27T11:38:46Z
2023-01-27T12:40:25Z
https://github.com/LibreDWG/libredwg/issues/607
1,559,609,461
607
[ "LibreDWG", "libredwg" ]
Actuall situation in my Debian: ``` /usr/bin/perl ./src/gen-dynapi.pl using gcc with /usr/lib/gcc/x86_64-linux-gnu/10/include stdint.h, line 26: file 'bits/libc-header-start.h' not found included from /usr/lib/gcc/x86_64-linux-gnu/10/include/stdint.h:9 included from ./include/dwg.h:33 at ./src/gen-dynapi.pl line 83. make: [Makefile:1259: regen-dynapi] Chyba 2 (ignorováno) ``` Output of ```gcc -print-search-dirs``` is: ``` install: /usr/lib/gcc/x86_64-linux-gnu/10/ programs: =/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/bin/ libraries: =/usr/lib/gcc/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/10/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/:/lib/x86_64-linux-gnu/10/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/10/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/10/../../../:/lib/:/usr/lib/ ``` In ```@ccincdir``` is ```/usr/lib/gcc/x86_64-linux-gnu/10/include``` which is not contain ```bits/libc-header-start.h``` Fix is something like this: ``` - ->Include('.', @ccincdir, '/usr/include/') + ->Include('.', @ccincdir, '/usr/include/', '/usr/include/x86_64-linux-gnu') ``` @rurban Is this fix ok, or is this something complex?
Fix make regen-dynapi on Debian
https://api.github.com/repos/LibreDWG/libredwg/issues/601/comments
4
2023-01-23T14:42:01Z
2023-01-25T08:38:14Z
https://github.com/LibreDWG/libredwg/issues/601
1,553,219,303
601
[ "LibreDWG", "libredwg" ]
Example: [HS1.DXF.gz](https://github.com/LibreDWG/libredwg/files/10474512/HS1.DXF.gz) [HS1.DWG.gz](https://github.com/LibreDWG/libredwg/files/10474513/HS1.DWG.gz) Actual output: ``` HANDLING: 1 [RS 70] HANDSEED: 0 [RSx 5] unknown_4f2: 4080275968 [RL 70] ``` In DXF is: ``` $HANDLING 70 1 9 $HANDSEED 5 1234F4 9 ```
Fix HANDSEED in preR13
https://api.github.com/repos/LibreDWG/libredwg/issues/596/comments
2
2023-01-22T13:57:43Z
2023-01-22T18:24:03Z
https://github.com/LibreDWG/libredwg/issues/596
1,552,128,605
596
[ "LibreDWG", "libredwg" ]
Hello! I found this recently, there is a similar one currently open but the call stack is different so I am reporting. Regards [bit_read_RC.zip](https://github.com/LibreDWG/libredwg/files/10471135/bit_read_RC.zip) ``` ./dwgread AddressSanitizer: heap-buffer-overflow on address 0x6220000000ff at pc 0x7ffff5e560c5 bp 0x7fffffffbf70 sp 0x7fffffffbf68 READ of size 1 at 0x6220000000ff thread T0 #0 0x7ffff5e560c4 in bit_read_RC /home/fmunozs/fuzz/libredwg/src/bits.c:320:10 #1 0x7ffff5e560c4 in bit_read_RS /home/fmunozs/fuzz/libredwg/src/bits.c:380:11 #2 0x7ffff5f24b30 in decode_preR13_entities /home/fmunozs/fuzz/libredwg/src/decode.c:6251:17 #3 0x7ffff60d3864 in decode_preR13 /home/fmunozs/fuzz/libredwg/src/decode_r11.c:873:12 #4 0x7ffff5e7778e in dwg_decode /home/fmunozs/fuzz/libredwg/src/decode.c:213:17 #5 0x7ffff60fb8cb in dwg_read_file /home/fmunozs/fuzz/libredwg/src/dwg.c:255:11 #6 0x555555670e8a in main /home/fmunozs/fuzz/libredwg/programs/dwgread.c #7 0x7ffff598628f (/usr/lib/libc.so.6+0x2328f) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584) #8 0x7ffff5986349 in __libc_start_main (/usr/lib/libc.so.6+0x23349) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584) #9 0x555555577224 in _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115 0x6220000000ff is located 1 bytes to the left of 5257-byte region [0x622000000100,0x622000001589) allocated by thread T0 here: #0 0x55555562c451 in __interceptor_calloc (/home/fmunozs/fuzz/libredwg/dwgread+0xd8451) (BuildId: fe467d4f4b88476b09aa33545596727c586b1ec3) #1 0x7ffff60facd9 in dat_read_file /home/fmunozs/fuzz/libredwg/src/dwg.c:91:33 #2 0x7ffff60fb798 in dwg_read_file /home/fmunozs/fuzz/libredwg/src/dwg.c:248:15 #3 0x555555670e8a in main /home/fmunozs/fuzz/libredwg/programs/dwgread.c #4 0x7ffff598628f (/usr/lib/libc.so.6+0x2328f) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fmunozs/fuzz/libredwg/src/bits.c:320:10 in bit_read_RC Shadow bytes around the buggy address: 0x0c447fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c447fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c447fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c447fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c447fff8000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c447fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa] 0x0c447fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c447fff8030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c447fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c447fff8050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c447fff8060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ```
AddressSanitizer: heap-buffer-overflow /libredwg/src/bits.c:320:10 in bit_read_RC
https://api.github.com/repos/LibreDWG/libredwg/issues/594/comments
0
2023-01-21T00:28:20Z
2023-01-25T20:56:38Z
https://github.com/LibreDWG/libredwg/issues/594
1,551,617,301
594
[ "LibreDWG", "libredwg" ]
We have different variables for same thing in preR13 and R13 versions Examples: [Drawing_r14.dxf.gz](https://github.com/LibreDWG/libredwg/files/10469189/Drawing_r14.dxf.gz) [Drawing_r14.dwg.gz](https://github.com/LibreDWG/libredwg/files/10469190/Drawing_r14.dwg.gz) [Drawing_r11.dxf.gz](https://github.com/LibreDWG/libredwg/files/10469191/Drawing_r11.dxf.gz) [Drawing_r11.dwg.gz](https://github.com/LibreDWG/libredwg/files/10469192/Drawing_r11.dwg.gz) In R11: ``` UNITMODE: 0 [RS 70] DEBUG_POS @1341.0 (10728) 000000001C007EFD5742000000000000F03F000000000000 RS :0 / 0x0000 (16) RL :0 / 0x00000000 (32) RD :-3065654374452100702700068470377681718323237861525184809381632932604485779920863438634634480952183588279191327718704389405575126647253555972756696551548588542298848213776963404130111761 27619814375290017650179825415209347897054436268637303863604519312689688318123099918712607357526589156302444822528.000000 (64) unknown (34): 000000001C007EFD5742000000000000F03F000000000000F03F000000000000F03F unknown_unit1: "m" [TFv 32 1] unknown_unit2: "" [TFv 32 1] unknown_unit3: "" [TFv 32 1] unknown_unit4: "" [TFv 32 1] ``` In R14: ``` unknown_0: 412148564080.000000 [BD 0] unknown_1: 1.000000 [BD 0] unknown_2: 1.000000 [BD 0] unknown_3: 1.000000 [BD 0] unknown_text1: "m" [TV 0] unknown_text2: "" [TV 0] unknown_text3: "" [TV 0] unknown_text4: "" [TV 0] ``` In R11 are 412148564080, 1, 1, 1 before unknown_unit1 too.
Unify unknown variable in header (preR13 and R13 versions)
https://api.github.com/repos/LibreDWG/libredwg/issues/592/comments
4
2023-01-20T18:47:08Z
2023-01-25T08:38:32Z
https://github.com/LibreDWG/libredwg/issues/592
1,551,298,459
592
[ "LibreDWG", "libredwg" ]
There is an init value (https://github.com/LibreDWG/libredwg/blob/master/src/decode_r11.c#L708): ``` unsigned num_sections = 5; ``` But not adding sections like (https://github.com/LibreDWG/libredwg/blob/master/src/dwg.c#L3051): ``` if (!dwg->header.numsections) dwg->header.numsections = 5; // HEADER.numsections is always 5 even if it needs to be 8 or 10, // probably because the additional sections are embedded in HEADER_VARS. // 5 tables + header + block. VIEW = 6 if (dwg->header.numheader_vars > 158) // r10 num_sections += 3; if (dwg->header.numheader_vars > 160) // r11 num_sections += 2; // and there is one hole we need to skip over. num_sections += 1; } ``` The actual situation is, that sections are not decoding.
Fix num_sections in decode_r11.c
https://api.github.com/repos/LibreDWG/libredwg/issues/591/comments
5
2023-01-20T18:27:15Z
2023-01-30T15:47:53Z
https://github.com/LibreDWG/libredwg/issues/591
1,551,279,935
591
[ "LibreDWG", "libredwg" ]
Example: [LT.scr.gz](https://github.com/LibreDWG/libredwg/files/10468962/LT.scr.gz) [LT.DWG.gz](https://github.com/LibreDWG/libredwg/files/10468963/LT.DWG.gz) ``` entities_start: 0x2e5 [RLx 0] entities_end: 0x2e5 [RLx 0] blocks_start: 0xffffc0bd [RLx 0] blocks_size: 0x0 [RLx 0] blocks_end: 0x0 [RLx 0] blocks_max: 0x80000000 [RLx 0] ``` and ```contents table VIEW [ 6]: size:91 num:0 (0xffffc0bd-0xffffc0bd) Warning: @0xc0bd => blocks_start 0xffffc0bd ERROR: bit_read_TF buffer overflow at 49341.4294901760 + 0 > 49341 unknown (-65536): ```
Issue with block_start in case with many linetypes (AC2.10)
https://api.github.com/repos/LibreDWG/libredwg/issues/589/comments
3
2023-01-20T18:12:11Z
2023-01-25T14:45:38Z
https://github.com/LibreDWG/libredwg/issues/589
1,551,262,845
589
[ "LibreDWG", "libredwg" ]
Example: [ANG3PT.scr.gz](https://github.com/LibreDWG/libredwg/files/10457003/ANG3PT.scr.gz) [ANG3PT.DXF.gz](https://github.com/LibreDWG/libredwg/files/10457004/ANG3PT.DXF.gz) [ANG3PT.DWG.gz](https://github.com/LibreDWG/libredwg/files/10457005/ANG3PT.DWG.gz) ![ANG3PT](https://user-images.githubusercontent.com/746282/213452280-26e16f55-92b2-4a7c-828e-0b5dbd04aa03.png) There is DXF16 variable in DWG file, but R14 dblist don't show it. How to name it?
How to name DIMENSION_ANG3PT DXF16 variable?
https://api.github.com/repos/LibreDWG/libredwg/issues/587/comments
15
2023-01-19T13:16:37Z
2023-01-20T10:01:04Z
https://github.com/LibreDWG/libredwg/issues/587
1,549,138,785
587
[ "LibreDWG", "libredwg" ]
Some lines do have in the very same DWG, e.g. TUTORIAL.DWG shipped with AutoCAD, no missing RD's, and some miss 2. The DXF misses those two values. ``` Add entity LINE [15] Decode entity LINE =========================== Entity number: 15, Type: 1, Addr: 5b2 flag_r11: 0x4 [RC 0] HAS_ELEVATION (4) size: 40 [RS] layer: 5 [H(RSd) 8] opts_r11: 0x0 [RSx 0] start: (85.226573, 183.698287) [2RD 10] end: (117.226573, 154.698287) [2RD 11] type: 1 [RCd] Add entity LINE [81] Decode entity LINE =========================== Entity number: 81, Type: 1, Addr: 135a flag_r11: 0x0 [RC 0] size: 56 [RS] layer: 6 [H(RSd) 8] opts_r11: 0x0 [RSx 0] start: (20.000000, 51.000000, -30.000000) [3RD 10] end: (20.000000, -51.000000, -30.000000) [3RD 11] type: 1 [RCd] Add entity LINE [87] Decode entity LINE =========================== Entity number: 87, Type: 1, Addr: 1482 flag_r11: 0x4 [RC 0] HAS_ELEVATION (4) size: 56 [RS] layer: 6 [H(RSd) 8] opts_r11: 0x0 [RSx 0] start: (20.000000, 51.000000) [2RD 10] end: (20.000000, -51.000000) [2RD 11] ERROR: offset 16 ``` Maybe we should look at the size also.
r10 LINE missing 2 doubles
https://api.github.com/repos/LibreDWG/libredwg/issues/586/comments
4
2023-01-19T11:10:10Z
2023-01-20T09:22:37Z
https://github.com/LibreDWG/libredwg/issues/586
1,548,950,055
586
[ "LibreDWG", "libredwg" ]
Not a bug, but a question. I am not a CAD user, and I don't have Autocad. But I've got some .dwg files that I need to read/convert to some other readable format. I tested a few free online readers/converters but looks like they are made for older .dwg versions. I guess my files are just the default Autocad 2022 .dwg output format since I was told they were produced with that version. Is libredwg supposed to handle that, or is it limited to older versions too? Thanks and sorry about the newbie question.
supported .dwg format versions?
https://api.github.com/repos/LibreDWG/libredwg/issues/584/comments
4
2023-01-18T20:10:28Z
2023-01-19T12:24:41Z
https://github.com/LibreDWG/libredwg/issues/584
1,538,643,309
584
[ "LibreDWG", "libredwg" ]
Example (created in R14): [DIM1.scr.gz](https://github.com/LibreDWG/libredwg/files/10445175/DIM1.scr.gz) [DIM1.DXF.gz](https://github.com/LibreDWG/libredwg/files/10445176/DIM1.DXF.gz) [DIM1.DWG.gz](https://github.com/LibreDWG/libredwg/files/10445177/DIM1.DWG.gz) ``` Add entity DIMENSION_ANG2LN [13] =========================== Entity number: 13, Type: 23, Addr: 6cf flag_r11: 0x20 [RC 0] HAS_HANDLING (32) size: 105 [RS] layer: 0 [H(RSd) 8] opts_r11: 0x801a [RSx 0] HAS_FLAG (2) HAS_DXF13 (8) HAS_DXF14 (16) Warning: Unknown opts_r11 (32794) handle: 0.1.5C [H 5] block: 0 [H(RSd) 2] def_pt: (3.000000, 2.000000, 0.000000) [3RD 10] text_midpt: (2.000000, 2.000000) [2RD 11] flag: 0x1 [RC 70] => Entity DIMENSION_ALIGNED xline1_pt: (1.000000, 1.000000, 0.000000) [3RD 13] xline2_pt: (3.000000, 1.000000, 0.000000) [3RD 14] ERROR: offset 2 crc: 07DC [RSx] ``` ERROR mean: 2 bytes for index to dimstyle section
Fix preR13 dimstyle index
https://api.github.com/repos/LibreDWG/libredwg/issues/582/comments
2
2023-01-18T11:45:41Z
2023-01-20T10:01:19Z
https://github.com/LibreDWG/libredwg/issues/582
1,537,857,355
582
[ "LibreDWG", "libredwg" ]
Attached reproduction case, tested against latest git version using ASAN enabled. I noticed two similar reports on the same function but those are already closed as fixed. [decode_preR13_section_hdr.zip](https://github.com/LibreDWG/libredwg/files/10441807/decode_preR13_section_hdr.zip) ``` ./dwgread decode_preR13_section_hdr.dwg ================================================================= ==2306955==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x618000000404 at pc 0x7ffff60e3888 bp 0x7fffffffc060 sp 0x7fffffffc058 WRITE of size 4 at 0x618000000404 thread T0 #0 0x7ffff60e3887 in decode_preR13_section_hdr /home/fmunozs/fuzz/libredwg/src/decode_r11.c:141:13 #1 0x7ffff60e151a in decode_preR13 /home/fmunozs/fuzz/libredwg/src/decode_r11.c:838:11 #2 0x7ffff5e8678e in dwg_decode /home/fmunozs/fuzz/libredwg/src/decode.c:213:17 #3 0x7ffff6109aab in dwg_read_file /home/fmunozs/fuzz/libredwg/src/dwg.c:255:11 #4 0x555555670e8a in main /home/fmunozs/fuzz/libredwg/programs/dwgread.c #5 0x7ffff599528f (/usr/lib/libc.so.6+0x2328f) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584) #6 0x7ffff5995349 in __libc_start_main (/usr/lib/libc.so.6+0x23349) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584) #7 0x555555577224 in _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115 0x618000000404 is located 4 bytes to the right of 896-byte region [0x618000000080,0x618000000400) allocated by thread T0 here: #0 0x55555562c451 in __interceptor_calloc (/home/fmunozs/fuzz/libredwg/dwgread+0xd8451) (BuildId: c1abb9f7e8ee3d6153ceee2eee78fd254e67b4dc) #1 0x7ffff6120a94 in dwg_init_sections /home/fmunozs/fuzz/libredwg/src/dwg.c:3097:26 #2 0x7ffff60e080c in decode_preR13 /home/fmunozs/fuzz/libredwg/src/decode_r11.c:725:12 #3 0x7ffff5e8678e in dwg_decode /home/fmunozs/fuzz/libredwg/src/decode.c:213:17 #4 0x7ffff6109aab in dwg_read_file /home/fmunozs/fuzz/libredwg/src/dwg.c:255:11 #5 0x555555670e8a in main /home/fmunozs/fuzz/libredwg/programs/dwgread.c #6 0x7ffff599528f (/usr/lib/libc.so.6+0x2328f) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fmunozs/fuzz/libredwg/src/decode_r11.c:141:13 in decode_preR13_section_hdr Shadow bytes around the buggy address: 0x0c307fff8030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c307fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c307fff8050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c307fff8060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c307fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c307fff8080:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c307fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==2306955==ABORTING ```
AddressSanitizer: heap-buffer-overflow libredwg/src/decode_r11.c:141:13 in decode_preR13_section_hdr
https://api.github.com/repos/LibreDWG/libredwg/issues/581/comments
1
2023-01-18T03:19:21Z
2023-01-18T10:12:41Z
https://github.com/LibreDWG/libredwg/issues/581
1,537,344,132
581
[ "LibreDWG", "libredwg" ]
Hello! I did some fuzz testing a while ago, just updated and recompiled, only the following crashes still reproduces. [file.zip](https://github.com/LibreDWG/libredwg/files/10422616/file.zip) This is the output with ASAN enabled: ``` ./dwgread file.dwg ================================================================= ==24832==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f0eb89fec16 at pc 0x7f0eb9a525a4 bp 0x7ffe5ec5a870 sp 0x7ffe5ec5a868 WRITE of size 8 at 0x7f0eb89fec16 thread T0 #0 0x7f0eb9a525a3 in copy_bytes /home/fmunozs/fuzz/libredwg/src/decode_r2007.c:229:12 #1 0x7f0eb9a525a3 in decompress_r2007 /home/fmunozs/fuzz/libredwg/src/decode_r2007.c:569:11 #2 0x7f0eb9a54734 in read_data_page /home/fmunozs/fuzz/libredwg/src/decode_r2007.c:754:13 #3 0x7f0eb9a54734 in read_data_section /home/fmunozs/fuzz/libredwg/src/decode_r2007.c:843:19 #4 0x7f0eb9a42c11 in read_2007_section_handles /home/fmunozs/fuzz/libredwg/src/decode_r2007.c:1673:11 #5 0x7f0eb9a42c11 in read_r2007_meta_data /home/fmunozs/fuzz/libredwg/src/decode_r2007.c:2430:12 #6 0x7f0eb97e841e in decode_R2007 /home/fmunozs/fuzz/libredwg/src/decode.c:3339:11 #7 0x7f0eb97d30ae in dwg_decode /home/fmunozs/fuzz/libredwg/src/decode.c:223:29 #8 0x7f0eb9a559cb in dwg_read_file /home/fmunozs/fuzz/libredwg/src/dwg.c:255:11 #9 0x56365ef23e8a in main /home/fmunozs/fuzz/libredwg/programs/dwgread.c #10 0x7f0eb92e128f (/usr/lib/libc.so.6+0x2328f) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584) #11 0x7f0eb92e1349 in __libc_start_main (/usr/lib/libc.so.6+0x23349) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584) #12 0x56365ee2a224 in _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115 0x7f0eb89fec16 is located 1 bytes to the right of 631829-byte region [0x7f0eb8964800,0x7f0eb89fec15) allocated by thread T0 here: #0 0x56365eedf451 in __interceptor_calloc (/home/fmunozs/fuzz/libredwg/dwgread+0xd8451) (BuildId: c1abb9f7e8ee3d6153ceee2eee78fd254e67b4dc) #1 0x7f0eb9a53e32 in read_data_section /home/fmunozs/fuzz/libredwg/src/decode_r2007.c:799:26 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fmunozs/fuzz/libredwg/src/decode_r2007.c:229:12 in copy_bytes Shadow bytes around the buggy address: 0x0fe257137d30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0fe257137d40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0fe257137d50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0fe257137d60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0fe257137d70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0fe257137d80: 00 00[05]fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe257137d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe257137da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe257137db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe257137dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fe257137dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==24832==ABORTING ```
AddressSanitizer: heap-buffer-overflow in copy_bytes libredwg/src/decode_r2007.c:229:12
https://api.github.com/repos/LibreDWG/libredwg/issues/578/comments
2
2023-01-16T04:54:01Z
2023-01-16T15:12:48Z
https://github.com/LibreDWG/libredwg/issues/578
1,534,294,018
578
[ "LibreDWG", "libredwg" ]
Rarely ``` ok 347 # write MTEXT to add_mtext_2000.dxf not ok 348 # read MTEXT from add_mtext_2000.dxf: 800 ok 349 # write LEADER to add_leader_2000.dxf not ok 350 # read LEADER from add_leader_2000.dxf: 800 ``` looks like a concurrency problem to me
flaky add_test
https://api.github.com/repos/LibreDWG/libredwg/issues/572/comments
0
2023-01-12T06:55:25Z
2023-01-20T09:22:48Z
https://github.com/LibreDWG/libredwg/issues/572
1,530,201,961
572
[ "LibreDWG", "libredwg" ]
I'm currently using the api to read xdata data, but I don't know dwg_obj_xrecord_get_xdata How to use the parameters of the xdata function? Please help me. Thank you very much
Is there an example of reading xdata data
https://api.github.com/repos/LibreDWG/libredwg/issues/564/comments
2
2023-01-07T09:58:28Z
2023-01-08T05:12:54Z
https://github.com/LibreDWG/libredwg/issues/564
1,523,669,925
564
[ "LibreDWG", "libredwg" ]
Files: [tmp_line.scr.gz](https://github.com/LibreDWG/libredwg/files/10347712/tmp_line.scr.gz) [tmp_line.dxf.gz](https://github.com/LibreDWG/libredwg/files/10347713/tmp_line.dxf.gz) [tmp_line.dwg.gz](https://github.com/LibreDWG/libredwg/files/10347714/tmp_line.dwg.gz) There is tmp line entity actually: ``` type: 129 [RCd] Add entity LINE [11] Decode entity LINE =========================== Entity number: 11, Type: 129, Addr: 512 flag_r11: 0x4 [RC 0] HAS_ELEVATION (4) size: 40 [RS] layer: 0 [H(RSd) 8] opts_r11: 0x0 [RSx 0] elevation_r11: 6.000000 [RD 38] start: (1.000000, 7.000000) [2RD 10] end: (2.000000, 0.000000) [2RD 11] ERROR: offset -8 ``` Type: 129 → bad usage of elevation
issue with tmp line entity
https://api.github.com/repos/LibreDWG/libredwg/issues/558/comments
5
2023-01-04T21:47:10Z
2023-01-05T11:45:59Z
https://github.com/LibreDWG/libredwg/issues/558
1,519,620,002
558
[ "LibreDWG", "libredwg" ]
Code: ``` #define LOG_FLAG_R11_MAX(w) \ if (_obj->flag_r11 > FLAG_R11_##w) \ LOG_WARN ("Unknown flag_r11 (0x%d)", _obj->flag_r11) ``` is not working. _obj->flag_r11 is e.g. 0xa0 (160) = composition of HAS_HANDLING (0x32) and HAS_ATTRIBS (0x128) And it's greater than the defined max value every time.
Issue with LOG_FLAG_R11_MAX
https://api.github.com/repos/LibreDWG/libredwg/issues/549/comments
3
2023-01-03T15:24:14Z
2023-01-04T06:35:32Z
https://github.com/LibreDWG/libredwg/issues/549
1,517,545,858
549
[ "LibreDWG", "libredwg" ]
[fit_curve_pline.scr.gz](https://github.com/LibreDWG/libredwg/files/10336468/fit_curve_pline.scr.gz) [fit_curve_pline.dxf.gz](https://github.com/LibreDWG/libredwg/files/10336469/fit_curve_pline.dxf.gz) [fit_curve_pline.dwg.gz](https://github.com/LibreDWG/libredwg/files/10336470/fit_curve_pline.dwg.gz) Something wierd: ``` entities: (0x3d5-0x431 (7), size 92, 0x0) ========================================== type: 18 [RCd] Add entity POLYLINE_2D [8] Decode entity POLYLINE_2D =========================== Entity number: 8, Type: 18, Addr: 3d5 flag_r11: 0x0 [RC 0] size: 8 [RS] layer: 146 [H(RSd) 8] opts_r11: 0x8000 [RSx 0] ``` 1) layer: 146, sic. 2) opts_r11: 0x8000 Second polyline: ``` type: 18 [RCd] Add entity POLYLINE_2D [9] Decode entity POLYLINE_2D =========================== Entity number: 9, Type: 18, Addr: 3dd flag_r11: 0x0 [RC 0] size: 24 [RS] layer: 73 [H(RSd) 8] opts_r11: 0x8000 [RSx 0] ERROR: offset 16 ``` Different size, same type.
Issue with Polyline in AC1003
https://api.github.com/repos/LibreDWG/libredwg/issues/548/comments
15
2023-01-03T12:19:04Z
2023-02-13T18:39:11Z
https://github.com/LibreDWG/libredwg/issues/548
1,517,314,901
548
[ "LibreDWG", "libredwg" ]
In https://github.com/LibreDWG/libredwg/blob/master/src/dwg.spec#L1167 we have: ``` if (R11OPTS (1)) FIELD_RC (has_vertex, 66); ``` This is bad, it's ``` if (R11OPTS (1)) FIELD_RC (flag, 70); ``` Same flag as https://github.com/LibreDWG/libredwg/blob/master/include/dwg.h#L1545: ``` BITCODE_BS flag; /* 1: closed, 2: curve_fit, 4: spline_fit, 8: 3d, 0x10: 3dmesh, 0x20: mesh_closed_in_n, 0x40: polyface_mesh, 0x80: ltype_continuous */ ``` Not short, but byte in preR13. In preR13 are used only 1 (closed) and 2 (curve_fit) probably
Fix polyline flag in preR13
https://api.github.com/repos/LibreDWG/libredwg/issues/542/comments
2
2023-01-01T21:46:55Z
2023-01-02T12:04:24Z
https://github.com/LibreDWG/libredwg/issues/542
1,515,853,092
542
[ "LibreDWG", "libredwg" ]
macOS diff -1 deprecation -bu1 interpretated as -b -u -1
macOS diff -1 deprecation
https://api.github.com/repos/LibreDWG/libredwg/issues/541/comments
0
2022-12-19T11:10:21Z
2022-12-23T08:37:10Z
https://github.com/LibreDWG/libredwg/issues/541
1,502,751,324
541
[ "LibreDWG", "libredwg" ]
Commit d6029e974 with changes in dwg_add_Document() is bad. Decoding process is: * read numheader_vars from DWG file * dwg_add_Document (which after this commit set this variable to different values) * usage of numheader_vars As I understand, we need to move this setting to dwg_new_Document()
Issue with reading of numheader_vars
https://api.github.com/repos/LibreDWG/libredwg/issues/540/comments
5
2022-12-18T07:31:09Z
2022-12-22T17:46:22Z
https://github.com/LibreDWG/libredwg/issues/540
1,501,797,494
540
[ "LibreDWG", "libredwg" ]
eg example_2004.dwg ``` Preview (31439) ------------------- overall size: 31403 [RL] num_pictures: 2 [RC] [0] Code: 1 [RC] Header data start: 0x1e7 [RL] Header data size: 80 [RL] [1] Code: 2 [RC] Header data start: 0x237 [RL] BMP size: 31304 [RL] BMP offset: 119 ERROR: Preview overflow 119 + 0 > 31407 Warning: thumbnail.size mismatch: 31407 != 0 ```
Wrong BMP preview logic
https://api.github.com/repos/LibreDWG/libredwg/issues/539/comments
1
2022-12-16T07:16:46Z
2022-12-31T19:10:24Z
https://github.com/LibreDWG/libredwg/issues/539
1,499,719,087
539
[ "LibreDWG", "libredwg" ]
they have FIELD_xx fields with an early return, but we changed the dat->chain, leading to invalid free errors later. As in #491 the spec does it properly with a nested private function it also makes no sense to have to maintain the same spec in 2 places, dwg.spec and decode_r11.c
use dwg.spec for preR13 tables
https://api.github.com/repos/LibreDWG/libredwg/issues/538/comments
0
2022-12-15T09:11:30Z
2023-02-12T16:31:06Z
https://github.com/LibreDWG/libredwg/issues/538
1,498,062,378
538
[ "LibreDWG", "libredwg" ]
### Discussed in https://github.com/LibreDWG/libredwg/discussions/515 <div type='discussions-op-text'> <sup>Originally posted by **cbvgn** August 4, 2022</sup> * [x] File 222.dxf has a root dictionary, but not as the first entity in the OBJECTS section as required * [x] File A2.dxf has an invalid empty line at line number 18395 and 18498, after fixing that same issue as in file 222.dxf [invalid files.zip](https://github.com/LibreDWG/libredwg/files/9256490/invalid.files.zip) </div>
Invalid DXF files created
https://api.github.com/repos/LibreDWG/libredwg/issues/536/comments
3
2022-12-13T12:59:33Z
2022-12-15T07:58:38Z
https://github.com/LibreDWG/libredwg/issues/536
1,494,191,165
536
[ "LibreDWG", "libredwg" ]
In input: ``` text "test" (0.0 1.0 0.0) 8 ``` dwgadd badly parse text string to `test"`
dwgadd issue in text entity
https://api.github.com/repos/LibreDWG/libredwg/issues/535/comments
11
2022-12-12T13:21:29Z
2022-12-13T12:25:52Z
https://github.com/LibreDWG/libredwg/issues/535
1,491,878,502
535
[ "LibreDWG", "libredwg" ]
Hi @rurban When we are decoding e.g. AC1.4 in Entity obj->type will be a number of entity in R11 (LINE = 1). When we are decoding e.g. AC1015 in Entity obj->type will be a number of entities in > R11 (LINE = 19). What about the unification of this type to the > R11 version? I think that we could do better conversions between versions after the change. Opposite example: When I use dwg_add_LINE, the type id will be 19 in every version. And I couldn't write this type to AC1.4 DWG file, because is bad. What do you think? I do some changes but I don't know what we want.
Entity type id
https://api.github.com/repos/LibreDWG/libredwg/issues/532/comments
3
2022-12-09T18:51:57Z
2022-12-12T06:47:56Z
https://github.com/LibreDWG/libredwg/issues/532
1,487,265,721
532
[ "LibreDWG", "libredwg" ]
writes wrong handle offsets via dwgadd. tested with dwgaddtest AC1014 r14
encode r13,r14 DICTIONARY.ownerhandle
https://api.github.com/repos/LibreDWG/libredwg/issues/531/comments
1
2022-12-09T13:28:37Z
2022-12-12T12:24:12Z
https://github.com/LibreDWG/libredwg/issues/531
1,486,764,836
531
[ "LibreDWG", "libredwg" ]
with r13,r14 only
XRECORD.objid_handles double-free
https://api.github.com/repos/LibreDWG/libredwg/issues/530/comments
1
2022-12-08T13:05:42Z
2022-12-12T12:24:02Z
https://github.com/LibreDWG/libredwg/issues/530
1,484,601,860
530
[ "LibreDWG", "libredwg" ]
see eg, dwgadd_test.sh
ACSH_init_evalgraph evalexpr leak
https://api.github.com/repos/LibreDWG/libredwg/issues/529/comments
0
2022-12-08T11:57:35Z
2023-09-20T07:48:33Z
https://github.com/LibreDWG/libredwg/issues/529
1,484,478,779
529
[ "LibreDWG", "libredwg" ]
**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
https://api.github.com/repos/LibreDWG/libredwg/issues/528/comments
0
2022-11-30T07:16:39Z
2022-12-01T08:12:50Z
https://github.com/LibreDWG/libredwg/issues/528
1,469,159,440
528
[ "LibreDWG", "libredwg" ]
**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_1?raw=true) **AddressSanitizer output** ==4083101==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000111d409 bp 0x7ffc26188290 sp 0x7ffc26188000 T0) ==4083101==The signal is caused by a READ memory access. ==4083101==Hint: address points to the zero page. #0 0x111d409 in decode_preR13 /home/SVF-tools/example/libredwg-2/src/decode_r11.c:740:11 #1 0x4fb4b6 in dwg_decode /home/SVF-tools/example/libredwg-2/src/decode.c:211:17 #2 0x4c6dcc in dwg_read_file /home/SVF-tools/example/libredwg-2/src/dwg.c:254:11 #3 0x4c4a40 in main /home/SVF-tools/example/libredwg-2/programs/dwg2dxf.c:258:15 #4 0x7fbb9e630c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #5 0x41b649 in _start (/home/SVF-tools/example/libredwg-2/fuzz/dwg2dxf.ci+0x41b649) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/SVF-tools/example/libredwg-2/src/decode_r11.c:740:11 in decode_preR13 ==4083101==ABORTING
A NULL pointer dereference exists in the function decode_preR13 in decode_r11.c
https://api.github.com/repos/LibreDWG/libredwg/issues/527/comments
1
2022-11-30T07:10:54Z
2022-11-30T12:04:32Z
https://github.com/LibreDWG/libredwg/issues/527
1,469,153,510
527
[ "LibreDWG", "libredwg" ]
**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/heap-buffer-overflow?raw=true) **AddressSanitizer output** ==4080011==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x618000000428 at pc 0x000000480860 bp 0x7ffddb1de850 sp 0x7ffddb1de008 WRITE of size 63 at 0x618000000428 thread T0 #0 0x48085f in strncpy /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:483:5 #1 0x1123350 in decode_preR13_section_hdr /home/SVF-tools/example/libredwg-2/src/decode_r11.c:139:3 #2 0x111d7e1 in decode_preR13 /home/SVF-tools/example/libredwg-2/src/decode_r11.c:762:7 #3 0x4fb4b6 in dwg_decode /home/SVF-tools/example/libredwg-2/src/decode.c:211:17 #4 0x4c6dcc in dwg_read_file /home/SVF-tools/example/libredwg-2/src/dwg.c:254:11 #5 0x4c4a40 in main /home/SVF-tools/example/libredwg-2/programs/dwg2dxf.c:258:15 #6 0x7f7873298c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #7 0x41b649 in _start (/home/SVF-tools/example/libredwg-2/fuzz/dwg2dxf.ci+0x41b649) 0x618000000428 is located 24 bytes inside of 442820362-byte region [0x618000000410,0x61801a64eb1a) ==4080011==AddressSanitizer CHECK failed: /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp:175 "((id)) != (0)" (0x0, 0x0) #0 0x49bf3e in __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_rtl.cpp:73:5 #1 0x4b045f in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /home/brian/src/final/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:78:5 #2 0x4245db in __asan::HeapAddressDescription::Print() const /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_descriptions.cpp #3 0x427425 in __asan::ErrorGeneric::Print() /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_errors.cpp:591:20 #4 0x497ba8 in __asan::ScopedInErrorReport::~ScopedInErrorReport() /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_report.cpp:141:50 #5 0x4997dd in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_report.cpp:474:1 #6 0x480881 in strncpy /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:483:5 #7 0x1123350 in decode_preR13_section_hdr /home/SVF-tools/example/libredwg-2/src/decode_r11.c:139:3 #8 0x111d7e1 in decode_preR13 /home/SVF-tools/example/libredwg-2/src/decode_r11.c:762:7 #9 0x4fb4b6 in dwg_decode /home/SVF-tools/example/libredwg-2/src/decode.c:211:17 #10 0x4c6dcc in dwg_read_file /home/SVF-tools/example/libredwg-2/src/dwg.c:254:11 #11 0x4c4a40 in main /home/SVF-tools/example/libredwg-2/programs/dwg2dxf.c:258:15 #12 0x7f7873298c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #13 0x41b649 in _start (/home/SVF-tools/example/libredwg-2/fuzz/dwg2dxf.ci+0x41b649)
heap-buffer-overflow exists in the function decode_preR13_section_hdr in decode_r11.c
https://api.github.com/repos/LibreDWG/libredwg/issues/524/comments
1
2022-11-13T04:23:10Z
2022-11-30T12:14:12Z
https://github.com/LibreDWG/libredwg/issues/524
1,446,725,478
524
[ "LibreDWG", "libredwg" ]
Hi, I am using dwg2SVG from docker. Have not managed to use this command for any of the files in the test folder [libredwg](https://github.com/LibreDWG/libredwg)/[test](https://github.com/LibreDWG/libredwg/tree/master/test)/test-data/. For example: dwg2SVG example_r14.dwg > example_r14.svg this gives an empty content file as attached. ![example_r14](https://user-images.githubusercontent.com/10716140/201299183-e4e9a583-3773-4c00-8b0e-1aca27aeb084.svg) or dwg2SVG example_2018.dwg > example_2018.svg ![example_2018](https://user-images.githubusercontent.com/10716140/201299223-637c9ae7-6ece-4205-85ad-5f0c6649333a.svg) .dwg files and .svg output , just in case [examples 2.zip](https://github.com/LibreDWG/libredwg/files/9989957/examples.2.zip)
dwg2SVG wrong viewBox
https://api.github.com/repos/LibreDWG/libredwg/issues/523/comments
10
2022-11-11T08:33:05Z
2024-03-08T03:04:38Z
https://github.com/LibreDWG/libredwg/issues/523
1,445,127,414
523
[ "LibreDWG", "libredwg" ]
Hello all, ## Context I recently forked the project and started to work in examples/dwg2svg.C to cover some my needs. I want to export architectural plans and keep the layers organization (either groups in svg or a layer-name attribute in each tags). I reached to add lwpolyline and ellipse export but I'm facing issues to get the layer name. ## Issue ```c static void output_LWPOLYLINE (dwg_object *obj) { int error, index, num_points; Dwg_Entity_LWPOLYLINE *poly; dwg_point_2d *points; index = dwg_object_get_index (obj, &error); log_if_error ("object_get_index"); poly = obj->tio.entity->tio.LWPOLYLINE; Dwg_Object_LAYER *layer = dwg_get_entity_layer(poly->parent); fprintf (stderr, "%s\n", layer->name); } ``` This print only the first letter of the name when the next two options go in segmentation fault: ```c //char *utf8 = bit_convert_TU (dwg_ent_get_layer_name(poly, &error)); //char *name =dwg_ent_get_layer_name(obj, &error); ``` As I didn't use C for many years, I think that I'm doing something wrong but don't no what. :'( Does someone see what's wrong??
How should I access to object's layer name?
https://api.github.com/repos/LibreDWG/libredwg/issues/522/comments
2
2022-10-19T20:57:31Z
2022-10-20T09:38:12Z
https://github.com/LibreDWG/libredwg/issues/522
1,415,576,441
522
[ "LibreDWG", "libredwg" ]
Hello everybody, I just re-install ubuntu 18 on my lap top and try to install libredwg. I done apt update and upgrade after installation, then installed python3.8 and pip and set it as default by editing the simlink and installed following packages: git autoconf libtool swig python-dev texinfo build-essential gcc Then, I have cloned the git repo, run successfully autogen.sh but when it comes to ./configure, I got some errors concerning python: ```shell checking python extra linking flags... -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions checking consistency of all components of python development environment... no configure: error: in `/home/bastien/soft/libredwg': configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LIBS environment variable. Example: ./configure LIBS="-L/usr/non-standard-path/python/lib" ============================================================================ ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================ See `config.log' for more details ``` I'm a bit confused as I didn't do anything special since the installation of ubuntu (I'd just install python 3.8 and replace /usr/bin/python to a symlink to python3.8). Does some one have an idea about what's going wrong there?
Failed to install on fresh Ubuntu installation with python3.8: Could not link test program to Python
https://api.github.com/repos/LibreDWG/libredwg/issues/521/comments
3
2022-10-17T23:31:12Z
2022-10-18T12:20:19Z
https://github.com/LibreDWG/libredwg/issues/521
1,412,366,825
521
[ "LibreDWG", "libredwg" ]
I have a dwg with drawing arcs. I tried to use dwgread.exe with GeoJSON output, it gives me null in geometry ![image](https://user-images.githubusercontent.com/58145645/195377116-225549e9-5352-4249-8bd2-03a0391c2898.png) Please If someone can help !! **note: I tried different dwg versions: AutoCad 2010, 2019 and same results
missing arcsplit, wrong null json value in geojson
https://api.github.com/repos/LibreDWG/libredwg/issues/520/comments
3
2022-10-12T14:56:48Z
2023-08-13T11:12:43Z
https://github.com/LibreDWG/libredwg/issues/520
1,406,361,637
520
[ "LibreDWG", "libredwg" ]
Hi, developers of libredwg: I also find an assertion failed in binay **dwglayers**. The input and the information are as follows. Any help would be greatly appreciated from you :D **input:** https://github.com/Yhcrown/fuzzing-crashes/blob/main/validated/dwglayers/0 **output:** ``` dwglayers: dwglayers.c:166: int main(int, char **): Assertion `_ctrl->entries[i]' failed. ``` **enviroment:** Ubuntu 22.04 LTS Linux lab-pro 4.15.0-147-generic gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 Ubuntu clang version 14.0.6 **Thanks & Best regards !**
Assertion failed in binary dwglayers
https://api.github.com/repos/LibreDWG/libredwg/issues/519/comments
4
2022-08-20T13:43:23Z
2022-12-01T08:13:13Z
https://github.com/LibreDWG/libredwg/issues/519
1,345,168,785
519
[ "LibreDWG", "libredwg" ]
Hi, developers of libredwg: Recently, I test some binaries instrumented with ASAN in libredwg . Unfortunately, some incurred crashes with the following error information. Any help would be greatly appreciated from you :D For binary **dwgread**: crash input: https://github.com/Yhcrown/fuzzing-crashes/blob/main/validated/dwgread/0 output: ``` ================================================================= ==78039==ERROR: AddressSanitizer: attempting double-free on 0x6040000180d0 in thread T0: #0 0x56381d83f022 in free (/workspace/libredwg/programs/dwgread+0x22c022) (BuildId: d78e358e2f9168522e4967bcbcf9dbaf26625dc7) #1 0x56381dc0bb42 in dwg_free_XRECORD_private /workspace/libredwg/src/./dwg.spec:6792:3 #2 0x56381db59ad2 in dwg_free_XRECORD /workspace/libredwg/src/./dwg.spec:6739:1 #3 0x56381dc0e7ae in dwg_free_object /workspace/libredwg/src/free.c:1060:7 #4 0x56381dc110d6 in dwg_free /workspace/libredwg/src/free.c:1512:13 #5 0x56381d87b4ca in main /workspace/libredwg/programs/dwgread.c:333:7 #6 0x7f1ea9659d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d) #7 0x7f1ea9659e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d) #8 0x56381d7bc484 in _start (/workspace/libredwg/programs/dwgread+0x1a9484) (BuildId: d78e358e2f9168522e4967bcbcf9dbaf26625dc7) 0x6040000180d0 is located 0 bytes inside of 48-byte region [0x6040000180d0,0x604000018100) freed by thread T0 here: #0 0x56381d83f022 in free (/workspace/libredwg/programs/dwgread+0x22c022) (BuildId: d78e358e2f9168522e4967bcbcf9dbaf26625dc7) #1 0x56381d9dec2c in dwg_decode_XRECORD_private /workspace/libredwg/src/./dwg.spec:6781:17 previously allocated by thread T0 here: #0 0x56381d83f2ce in __interceptor_malloc (/workspace/libredwg/programs/dwgread+0x22c2ce) (BuildId: d78e358e2f9168522e4967bcbcf9dbaf26625dc7) #1 0x56381d9de8c6 in dwg_decode_XRECORD_private /workspace/libredwg/src/./dwg.spec:6776:27 SUMMARY: AddressSanitizer: double-free (/workspace/libredwg/programs/dwgread+0x22c022) (BuildId: d78e358e2f9168522e4967bcbcf9dbaf26625dc7) in free ==78039==ABORTING ``` For binary **dwgbmp**: crash input: https://github.com/Yhcrown/fuzzing-crashes/blob/main/validated/dwgbmp/0 output: ``` ================================================================= ==82075==ERROR: AddressSanitizer: attempting double-free on 0x6040000051d0 in thread T0: #0 0x5584dfc9c002 in free (/workspace/libredwg/programs/dwgbmp+0x19d002) (BuildId: ec27550ef88545eef0fdc77a46b25d158c3c8aa8) #1 0x5584e0069372 in dwg_free_XRECORD_private /workspace/libredwg/src/./dwg.spec:6792:3 #2 0x5584dffb7302 in dwg_free_XRECORD /workspace/libredwg/src/./dwg.spec:6739:1 #3 0x5584e006bfde in dwg_free_object /workspace/libredwg/src/free.c:1060:7 #4 0x5584e006e906 in dwg_free /workspace/libredwg/src/free.c:1512:13 #5 0x5584dfcd8121 in get_bmp /workspace/libredwg/programs/dwgbmp.c #6 0x5584dfcd8121 in main /workspace/libredwg/programs/dwgbmp.c:301:11 #7 0x7f6d1a2b0d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d) #8 0x7f6d1a2b0e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d) #9 0x5584dfc19464 in _start (/workspace/libredwg/programs/dwgbmp+0x11a464) (BuildId: ec27550ef88545eef0fdc77a46b25d158c3c8aa8) 0x6040000051d0 is located 0 bytes inside of 48-byte region [0x6040000051d0,0x604000005200) freed by thread T0 here: #0 0x5584dfc9c002 in free (/workspace/libredwg/programs/dwgbmp+0x19d002) (BuildId: ec27550ef88545eef0fdc77a46b25d158c3c8aa8) #1 0x5584dfe3c45c in dwg_decode_XRECORD_private /workspace/libredwg/src/./dwg.spec:6781:17 previously allocated by thread T0 here: #0 0x5584dfc9c2ae in __interceptor_malloc (/workspace/libredwg/programs/dwgbmp+0x19d2ae) (BuildId: ec27550ef88545eef0fdc77a46b25d158c3c8aa8) #1 0x5584dfe3c0f6 in dwg_decode_XRECORD_private /workspace/libredwg/src/./dwg.spec:6776:27 SUMMARY: AddressSanitizer: double-free (/workspace/libredwg/programs/dwgbmp+0x19d002) (BuildId: ec27550ef88545eef0fdc77a46b25d158c3c8aa8) in free ==82075==ABORTING ``` For binary **dwglayers**: crash input: https://github.com/Yhcrown/fuzzing-crashes/blob/main/validated/dwglayers/9 output: ``` 0 Tavolo 2 Tavolo 3 Defpoints ADSK_SYSTEM_LIGHTS ================================================================= ==53887==ERROR: AddressSanitizer: attempting double-free on 0x6040000b8850 in thread T0: #0 0x5639cf98aff2 in free (/workspace/libredwg/programs/dwglayers+0x19cff2) (BuildId: be6310fd94058a60a255f09e79d9fc62db79b781) #1 0x5639cfd57062 in dwg_free_XRECORD_private /workspace/libredwg/src/./dwg.spec:6792:3 #2 0x5639cfca4ff2 in dwg_free_XRECORD /workspace/libredwg/src/./dwg.spec:6739:1 #3 0x5639cfd59cce in dwg_free_object /workspace/libredwg/src/free.c:1060:7 #4 0x5639cfd5c5f6 in dwg_free /workspace/libredwg/src/free.c:1512:13 #5 0x5639cf9c6bf1 in main /workspace/libredwg/programs/dwglayers.c:214:5 #6 0x7f96269ffd8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d) #7 0x7f96269ffe3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d) #8 0x5639cf908454 in _start (/workspace/libredwg/programs/dwglayers+0x11a454) (BuildId: be6310fd94058a60a255f09e79d9fc62db79b781) 0x6040000b8850 is located 0 bytes inside of 48-byte region [0x6040000b8850,0x6040000b8880) freed by thread T0 here: #0 0x5639cf98aff2 in free (/workspace/libredwg/programs/dwglayers+0x19cff2) (BuildId: be6310fd94058a60a255f09e79d9fc62db79b781) #1 0x5639cfb2a14c in dwg_decode_XRECORD_private /workspace/libredwg/src/./dwg.spec:6781:17 previously allocated by thread T0 here: #0 0x5639cf98b29e in __interceptor_malloc (/workspace/libredwg/programs/dwglayers+0x19d29e) (BuildId: be6310fd94058a60a255f09e79d9fc62db79b781) #1 0x5639cfb29de6 in dwg_decode_XRECORD_private /workspace/libredwg/src/./dwg.spec:6776:27 SUMMARY: AddressSanitizer: double-free (/workspace/libredwg/programs/dwglayers+0x19cff2) (BuildId: be6310fd94058a60a255f09e79d9fc62db79b781) in free ==53887==ABORTING ``` ### Verification steps: ``` git clone https://github.com/LibreDWG/libredwg cd libredwg/ sh ./autogen.sh CC=clang CFLAGS='-U_FORTIFY_SOURCE -fsanitize=address' LDFLAGS='-U_FORTIFY_SOURCE -fsanitize=address' ./configure --disable-shared --disable-write --enable-trace --enable-release make -j ./binary ./crash-input ``` enviroment: Ubuntu 22.04 LTS Linux lab-pro 4.15.0-147-generic gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 Ubuntu clang version 14.0.6 **Thanks & Best regards !**
attempting double-free in function dwg_free_XRECORD_private
https://api.github.com/repos/LibreDWG/libredwg/issues/518/comments
0
2022-08-20T13:37:50Z
2022-12-13T04:55:53Z
https://github.com/LibreDWG/libredwg/issues/518
1,345,167,573
518
[ "LibreDWG", "libredwg" ]
Hello, I'd like to ask whether there are relevant examples of block that can be read, whether block has offset values and other relevant parameters, and how I can get them. I'm looking forward to your reply, thank you!
How to Read Block?
https://api.github.com/repos/LibreDWG/libredwg/issues/517/comments
0
2022-08-04T14:45:02Z
2022-08-15T00:03:21Z
https://github.com/LibreDWG/libredwg/issues/517
1,328,747,508
517
[ "LibreDWG", "libredwg" ]
File 222.dxf has a root dictionary, but not as the first entity in the OBJECTS section as required File A2.dxf has an invalid empty line at line number 18395 and 18498, after fixing that same issue as in file 222.dxf [invalid files.zip](https://github.com/LibreDWG/libredwg/files/9257875/invalid.files.zip)
Some invalid DXF files were created
https://api.github.com/repos/LibreDWG/libredwg/issues/516/comments
1
2022-08-04T08:17:52Z
2022-12-14T12:01:25Z
https://github.com/LibreDWG/libredwg/issues/516
1,328,246,267
516
[ "LibreDWG", "libredwg" ]
layer indexed colors works only in dxf2000 [dxf_colors.zip](https://github.com/LibreDWG/libredwg/files/9229233/dxf_colors.zip)
Wrong layer indexed colors for dxf2004,2007,2010,2013,2018
https://api.github.com/repos/LibreDWG/libredwg/issues/513/comments
3
2022-07-31T15:59:07Z
2023-06-27T10:22:00Z
https://github.com/LibreDWG/libredwg/issues/513
1,323,499,752
513
[ "LibreDWG", "libredwg" ]
layer indexed colors works only in dwg2000 [dwg_colors.zip](https://github.com/LibreDWG/libredwg/files/9229232/dwg_colors.zip)
Wrong layer indexed colors for dwg2004,2007,2010,2013,2018
https://api.github.com/repos/LibreDWG/libredwg/issues/512/comments
2
2022-07-31T15:58:02Z
2023-06-27T10:17:49Z
https://github.com/LibreDWG/libredwg/issues/512
1,323,499,490
512
[ "LibreDWG", "libredwg" ]
if I try load dxf different versions, I get 0 for on, locked, plotflag for all layer [layersdxf.zip](https://github.com/LibreDWG/libredwg/files/9228210/layersdxf.zip)
Wrong layers properties after dxf loading
https://api.github.com/repos/LibreDWG/libredwg/issues/510/comments
1
2022-07-31T07:05:35Z
2022-11-30T12:15:29Z
https://github.com/LibreDWG/libredwg/issues/510
1,323,381,133
510
[ "LibreDWG", "libredwg" ]
I'm trying to import dwg, but I'm losing information about printing layers
_dwg_object_LAYER.plotflag always 0
https://api.github.com/repos/LibreDWG/libredwg/issues/509/comments
3
2022-07-29T12:41:09Z
2022-07-30T20:48:29Z
https://github.com/LibreDWG/libredwg/issues/509
1,322,201,512
509
[ "LibreDWG", "libredwg" ]
Hello, please delete this issue. I discovered the source of the problem. Sorry.
Extrusion direction
https://api.github.com/repos/LibreDWG/libredwg/issues/501/comments
0
2022-07-13T13:15:21Z
2022-07-13T18:45:16Z
https://github.com/LibreDWG/libredwg/issues/501
1,303,423,725
501
[ "LibreDWG", "libredwg" ]
I tested on smoke/preR13 and work/preR13 branches ``` $ make distclean $ ./configure --disable-write $ make ``` Error: ``` ... CCLD dwgread /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_LAYER' /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_STYLE' /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_APPID' /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_LTYPE' /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_VIEW' /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_DIMSTYLE' /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_VPORT' /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_BLOCK_HEADER' /usr/bin/ld: ../src/.libs/libredwg.so: undefined reference to `dwg_add_Document' collect2: error: ld returned 1 exit status ... ```
Cannot build libredwg with --disable-write
https://api.github.com/repos/LibreDWG/libredwg/issues/498/comments
5
2022-06-24T10:49:04Z
2022-07-31T12:57:07Z
https://github.com/LibreDWG/libredwg/issues/498
1,283,596,621
498
[ "LibreDWG", "libredwg" ]
# Vulnerability description version: [0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608) & latest commit [f2dea29](https://github.com/LibreDWG/libredwg/commit/f2dea296a0a3bb16afdae8d2ca16749a617a4383) poc: [poc](https://github.com/0xdd96/PoC/raw/main/libredwg/UAF-bit_copy_chain) command: ./dwgrewrite poc **_This is similar to issue #364 and others, but it seems that the patch https://github.com/LibreDWG/libredwg/commit/e95cc1eea8744c40e298208679eda14039b9b5d3 has not fully fixed them._** Here is the trace reported by ASAN: ``` ==28024==ERROR: AddressSanitizer: heap-use-after-free on address 0x7ffff3b65800 at pc 0x5555564f67f6 bp 0x7fffffff6760 sp 0x7fffffff6750 READ of size 1 at 0x7ffff3b65800 thread T0 #0 0x5555564f67f5 in bit_read_RC libredwg/src/bits.c:317 #1 0x5555564f67f5 in bit_copy_chain libredwg/src/bits.c:3352 #2 0x555556105ec6 in obj_flush_hdlstream libredwg/src/encode.c:833 #3 0x555556105ec6 in dwg_encode_PLANESURFACE_private libredwg/src/dwg.spec:9150 #4 0x5555563a57df in dwg_encode_PLANESURFACE libredwg/src/dwg.spec:9136 #5 0x5555563a57df in dwg_encode_variable_type libredwg/src/classes.inc:247 #6 0x5555563ab3d0 in dwg_encode_add_object libredwg/src/encode.c:4432 #7 0x5555563c914c in dwg_encode libredwg/src/encode.c:2769 #8 0x55555575ca00 in dwg_write_file libredwg/src/dwg.c:429 #9 0x555555758a3f in main libredwg/programs/dwgrewrite.c:350 #10 0x7ffff726f0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2) #11 0x55555575924d in _start (libredwg/build-ASAN/dwgrewrite+0x20524d) 0x7ffff3b65800 is located 0 bytes inside of 208896-byte region [0x7ffff3b65800,0x7ffff3b98800) freed by thread T0 here: #0 0x7ffff7699ffe in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe) #1 0x5555564f532c in bit_chain_alloc_size libredwg/src/bits.c:3046 #2 0x5555564f532c in bit_chain_alloc libredwg/src/bits.c:3062 #3 0x5555564f532c in bit_copy_chain libredwg/src/bits.c:3339 #4 0x1900000105 (<unknown module>) previously allocated by thread T0 here: #0 0x7ffff7699ffe in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe) #1 0x5555564f396f in bit_chain_alloc_size libredwg/src/bits.c:3046 #2 0x5555564f396f in bit_chain_alloc libredwg/src/bits.c:3062 #3 0x31fff (<unknown module>) ``` # Vulnerability analysis When running to `bit_copy_chain`, both `dat->chain` and `tmp_dat->chain` point to `0x7ffff3b65800` (see the gdb output below). This will lead to use-after-free, since line 3339 calls `realloc`, which frees the chunk `0x7ffff3b65800`, and line 3352 ties to read from the freed chunk. Also note that the comment says `bit_copy_chain` *Copy the whole content of tmp_data to dat, and reset tmp_dat*, so why `dat->chain = tmp_dat->chain` in this PoC should be further investigated. https://github.com/LibreDWG/libredwg/blob/f2dea296a0a3bb16afdae8d2ca16749a617a4383/src/bits.c#L3333-L3360 ``` pwndbg> p *dat $6 = { chain = 0x7ffff3b65800, size = 208896, byte = 204890, bit = 6 '\006', opts = 1 '\001', version = R_2000, from_version = R_2004, fh = 0x0 } pwndbg> p *tmp_dat $10 = { chain = 0x7ffff3b65800, size = 208896, byte = 204882, bit = 6 '\006', opts = 1 '\001', version = R_2000, from_version = R_2004, fh = 0x0 } ```
Heap use-after-free still exists in the bit_copy_chain
https://api.github.com/repos/LibreDWG/libredwg/issues/497/comments
2
2022-06-17T12:04:26Z
2023-06-27T10:19:27Z
https://github.com/LibreDWG/libredwg/issues/497
1,274,949,181
497
[ "LibreDWG", "libredwg" ]
I download the libredwg-0.12.5-win32.zip,then I find the lib is libredwg.dll.a.In general, the file format in visual studio is .lib Is there an example of using libredwg in Visual Studio?
How to use libredwg in Visual Studio?
https://api.github.com/repos/LibreDWG/libredwg/issues/496/comments
1
2022-06-13T03:33:59Z
2022-06-13T06:23:58Z
https://github.com/LibreDWG/libredwg/issues/496
1,268,853,789
496
[ "LibreDWG", "libredwg" ]
Someone is not setting dwg->dirty_refs when reallocing some objects, leading to wrong ref->obj's, leading to unit-test errors/regressions. find the culprit, blocks merge of the preR13 branch.
missing dwg->dirty_refs in preR13 regression
https://api.github.com/repos/LibreDWG/libredwg/issues/495/comments
1
2022-06-09T10:44:07Z
2022-07-28T15:28:48Z
https://github.com/LibreDWG/libredwg/issues/495
1,265,942,087
495
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==9543==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffc8f0 at pc 0x0000007257bb bp 0x7fffffffbc90 sp 0x7fffffffbc88 WRITE of size 1 at 0x7fffffffc8f0 thread T0 #0 0x7257ba in copy_bytes /testcase/libredwg/src/decode_r2007.c:228:12 #1 0x7257ba in decompress_r2007 /testcase/libredwg/src/decode_r2007.c:563 #2 0x712263 in read_file_header /testcase/libredwg/src/decode_r2007.c:1247:13 #3 0x712263 in read_r2007_meta_data /testcase/libredwg/src/decode_r2007.c:2354 #4 0x533116 in decode_R2007 /testcase/libredwg/src/decode.c:3231:11 #5 0x533116 in dwg_decode /testcase/libredwg/src/decode.c:212 #6 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #7 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #8 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #9 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) Address 0x7fffffffc8f0 is located in stack of thread T0 at offset 2736 in frame #0 0x71159f in read_r2007_meta_data /testcase/libredwg/src/decode_r2007.c:2338 This frame has 23 object(s): [32, 40) 'acis_sab_data.i.i' [64, 65) 'acis_empty.i.i' [80, 82) 'version1913.i.i' [96, 100) 'size1930.i.i' [112, 160) 'sec_dat.i548' [192, 240) 'sec_dat.i515' [272, 320) 'sec_dat.i492' [352, 400) 'sec_dat.i455' [432, 480) 'sec_dat.i424' [512, 560) 'sec_dat.i391' [592, 640) 'sec_dat.i356' [672, 720) 'sec_dat.i330' [752, 800) 'sec_dat.i301' [832, 836) 'size.i282' [848, 873) 'old_dat.sroa.0.i' [912, 960) 'sec_dat.i268' [992, 1040) 'sec_dat.i220' [1072, 1120) 'str.i' [1152, 1200) 'sec_dat.i' [1232, 1280) 'str_dat.i' [1312, 1320) 'ptr.i' [1344, 2328) 'data.i' [2464, 2736) 'file_header' <== Memory access at offset 2736 overflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow /testcase/libredwg/src/decode_r2007.c:228:12 in copy_bytes Shadow bytes around the buggy address: 0x10007fff78c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff78d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff78e0: 00 00 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 f2 0x10007fff78f0: f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 00 00 00 00 0x10007fff7900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x10007fff7910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[f3]f3 0x10007fff7920: f3 f3 f3 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 0x10007fff7930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7950: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7960: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==9543==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/copy_bytes_sof
stack-buffer-overflow exists in the function copy_bytes in decode_r2007.c
https://api.github.com/repos/LibreDWG/libredwg/issues/494/comments
3
2022-06-08T01:51:23Z
2022-12-15T08:47:23Z
https://github.com/LibreDWG/libredwg/issues/494
1,264,082,849
494
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==9541==ERROR: AddressSanitizer: attempting double-free on 0x61a000000100 in thread T0: #0 0x4d23a0 in __interceptor_cfree.localalias.0 /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:55 #1 0x50d77a in dwg_read_file /testcase/libredwg/src/dwg.c:258:7 #2 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #3 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #4 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) 0x61a000000100 is located 128 bytes inside of 1321-byte region [0x61a000000080,0x61a0000005a9) allocated by thread T0 here: #0 0x4d2750 in calloc /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74 #1 0x50cdd0 in dat_read_file /testcase/libredwg/src/dwg.c:91:33 #2 0x50d708 in dwg_read_file /testcase/libredwg/src/dwg.c:247:15 #3 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #4 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 SUMMARY: AddressSanitizer: double-free /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:55 in __interceptor_cfree.localalias.0 ==9541==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/dwg_read_file_df
double-free exists in the function dwg_read_file in dwg.c
https://api.github.com/repos/LibreDWG/libredwg/issues/493/comments
2
2022-06-08T01:47:21Z
2022-12-01T08:12:49Z
https://github.com/LibreDWG/libredwg/issues/493
1,264,080,771
493
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### output dwg2dxf: decode.c:5801: int decode_preR13_entities(BITCODE_RL, BITCODE_RL, unsigned int, BITCODE_RL, BITCODE_RL, Bit_Chain *, Dwg_Data *): Assertion `!dat->bit' failed. Aborted ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/decode_preR13_entities_Assertion
Assertion dwg2dxf: decode.c:5801: int decode_preR13_entities(BITCODE_RL, BITCODE_RL, unsigned int, BITCODE_RL, BITCODE_RL, Bit_Chain *, Dwg_Data *): Assertion `!dat->bit' failed. Aborted.
https://api.github.com/repos/LibreDWG/libredwg/issues/492/comments
4
2022-06-07T01:43:47Z
2022-12-15T08:04:07Z
https://github.com/LibreDWG/libredwg/issues/492
1,262,615,938
492
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==8999==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x61a0000000e0 in thread T0 #0 0x4d23a0 in __interceptor_cfree.localalias.0 /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:55 #1 0x50d77a in dwg_read_file /testcase/libredwg/src/dwg.c:258:7 #2 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #3 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #4 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) 0x61a0000000e0 is located 96 bytes inside of 1309-byte region [0x61a000000080,0x61a00000059d) allocated by thread T0 here: #0 0x4d2750 in calloc /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74 #1 0x50cdd0 in dat_read_file /testcase/libredwg/src/dwg.c:91:33 #2 0x50d708 in dwg_read_file /testcase/libredwg/src/dwg.c:247:15 #3 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #4 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 SUMMARY: AddressSanitizer: bad-free /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:55 in __interceptor_cfree.localalias.0 ==8999==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/dwg_read_file_baffree
bad-free exists in the function dwg_read_file in dwg.c
https://api.github.com/repos/LibreDWG/libredwg/issues/491/comments
3
2022-06-07T01:41:57Z
2022-12-15T09:10:27Z
https://github.com/LibreDWG/libredwg/issues/491
1,262,615,064
491
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==8997==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000000730 at pc 0x000000517369 bp 0x7fffffffc7d0 sp 0x7fffffffc7c8 READ of size 8 at 0x604000000730 thread T0 #0 0x517368 in dwg_add_handleref /testcase/libredwg/src/dwg.c:2014:21 #1 0x7ea615 in dwg_add_BLOCK_HEADER /testcase/libredwg/src/dwg_api.c:24588:3 #2 0x70baf6 in decode_preR13_section /testcase/libredwg/src/decode_r11.c:325:20 #3 0x705d0a in decode_preR13 /testcase/libredwg/src/decode_r11.c:830:12 #4 0x53245a in dwg_decode /testcase/libredwg/src/decode.c:209:23 #5 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #6 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #7 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #8 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) 0x604000000730 is located 32 bytes inside of 48-byte region [0x604000000710,0x604000000740) freed by thread T0 here: #0 0x4d23a0 in __interceptor_cfree.localalias.0 /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:55 #1 0x7070a2 in decode_preR13_header_variables /testcase/libredwg/src/./header_variables_r11.spec:65:3 #2 0x232900001100144d (<unknown module>) previously allocated by thread T0 here: #0 0x4d2750 in calloc /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74 #1 0x54900c in dwg_new_ref /testcase/libredwg/src/decode.c:4027:43 SUMMARY: AddressSanitizer: heap-use-after-free /testcase/libredwg/src/dwg.c:2014:21 in dwg_add_handleref Shadow bytes around the buggy address: 0x0c087fff8090: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 fa 0x0c087fff80a0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff80b0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff80c0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff80d0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 =>0x0c087fff80e0: fa fa fd fd fd fd[fd]fd fa fa 00 00 00 00 00 00 0x0c087fff80f0: fa fa 00 00 00 00 00 00 fa fa fd fd fd fd fd fd 0x0c087fff8100: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff8110: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff8120: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 0x0c087fff8130: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==8997==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/dwg_add_handleref_uaf
heap-use-after-free exists in the function dwg_add_handleref in dwg.c
https://api.github.com/repos/LibreDWG/libredwg/issues/490/comments
3
2022-06-07T01:40:09Z
2022-12-15T08:40:34Z
https://github.com/LibreDWG/libredwg/issues/490
1,262,614,234
490
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==8995==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62e00000ac80 at pc 0x0000004bc125 bp 0x7fffffffc7c0 sp 0x7fffffffbf70 WRITE of size 168 at 0x62e00000ac80 thread T0 #0 0x4bc124 in __asan_memset /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_interceptors.cc:457 #1 0x5a062e in dwg_add_object /testcase/libredwg/src/decode.c:4740:3 #2 0x7e0942 in dwg_add_VIEW /testcase/libredwg/src/dwg_api.c:24619:3 #3 0x70c71e in decode_preR13_section /testcase/libredwg/src/decode_r11.c:434:13 #4 0x705d7a in decode_preR13 /testcase/libredwg/src/decode_r11.c:834:12 #5 0x53245a in dwg_decode /testcase/libredwg/src/decode.c:209:23 #6 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #7 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #8 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #9 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) 0x62e00000ac80 is located 0 bytes to the right of 43136-byte region [0x62e000000400,0x62e00000ac80) allocated by thread T0 here: #0 0x4d2968 in realloc /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:79 #1 0x70b9ca in decode_preR13_section /testcase/libredwg/src/decode_r11.c:273:32 #2 0x705d7a in decode_preR13 /testcase/libredwg/src/decode_r11.c:834:12 #3 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #4 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #5 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 SUMMARY: AddressSanitizer: heap-buffer-overflow /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_interceptors.cc:457 in __asan_memset Shadow bytes around the buggy address: 0x0c5c7fff9540: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c5c7fff9550: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c5c7fff9560: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c5c7fff9570: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c5c7fff9580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c5c7fff9590:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c7fff95a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c7fff95b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c7fff95c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c7fff95d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c7fff95e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==8995==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/dwg_add_object_bof
heap-buffer-overflow exists in the function dwg_add_object in decode.c
https://api.github.com/repos/LibreDWG/libredwg/issues/489/comments
3
2022-06-07T01:37:45Z
2022-12-15T08:41:39Z
https://github.com/LibreDWG/libredwg/issues/489
1,262,613,027
489
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==8993==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x611000000144 at pc 0x0000007064dc bp 0x7fffffffca00 sp 0x7fffffffc9f8 WRITE of size 4 at 0x611000000144 thread T0 #0 0x7064db in decode_preR13_section_hdr /testcase/libredwg/src/decode_r11.c:136:13 #1 0x70583b in decode_preR13 /testcase/libredwg/src/decode_r11.c:737:12 #2 0x53245a in dwg_decode /testcase/libredwg/src/decode.c:209:23 #3 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #4 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #5 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #6 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) 0x611000000144 is located 4 bytes to the right of 256-byte region [0x611000000040,0x611000000140) allocated by thread T0 here: #0 0x4d2750 in calloc /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74 #1 0x7055f0 in decode_preR13 /testcase/libredwg/src/decode_r11.c:700:40 #2 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #3 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #4 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 SUMMARY: AddressSanitizer: heap-buffer-overflow /testcase/libredwg/src/decode_r11.c:136:13 in decode_preR13_section_hdr Shadow bytes around the buggy address: 0x0c227fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c227fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c227fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c227fff8000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c227fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c227fff8020: 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa 0x0c227fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c227fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c227fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c227fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c227fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==8993==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/decode_preR13_section_hdr_bof
heap-buffer-overflow exists in the function decode_preR13_section_hdr in decode_r11.c
https://api.github.com/repos/LibreDWG/libredwg/issues/488/comments
3
2022-06-07T01:34:49Z
2022-12-15T08:43:05Z
https://github.com/LibreDWG/libredwg/issues/488
1,262,611,394
488
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==8989==ERROR: AddressSanitizer: heap-use-after-free on address 0x7ffff7e35838 at pc 0x0000007106ca bp 0x7fffffffc8b0 sp 0x7fffffffc8a8 READ of size 8 at 0x7ffff7e35838 thread T0 #0 0x7106c9 in decode_preR13_section /testcase/libredwg/src/decode_r11.c:339:35 #1 0x705d0a in decode_preR13 /testcase/libredwg/src/decode_r11.c:830:12 #2 0x53245a in dwg_decode /testcase/libredwg/src/decode.c:209:23 #3 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #4 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #5 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #6 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) 0x7ffff7e35838 is located 56 bytes inside of 172032-byte region [0x7ffff7e35800,0x7ffff7e5f800) freed by thread T0 here: #0 0x4d2968 in realloc /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:79 #1 0x5a05b5 in dwg_add_object /testcase/libredwg/src/decode.c:4730:35 previously allocated by thread T0 here: #0 0x4d2750 in calloc /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74 #1 0x5a0465 in dwg_add_object /testcase/libredwg/src/decode.c:4719:35 SUMMARY: AddressSanitizer: heap-use-after-free /testcase/libredwg/src/decode_r11.c:339:35 in decode_preR13_section Shadow bytes around the buggy address: 0x10007efbeab0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efbeac0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efbead0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efbeae0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efbeaf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x10007efbeb00: fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd 0x10007efbeb10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x10007efbeb20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x10007efbeb30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x10007efbeb40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x10007efbeb50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==8989==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/decode_preR13_uaf
heap-use-after-free exists in the function decode_preR13_section in decode_r11.c
https://api.github.com/repos/LibreDWG/libredwg/issues/487/comments
3
2022-06-07T01:31:30Z
2022-12-15T08:44:07Z
https://github.com/LibreDWG/libredwg/issues/487
1,262,609,657
487
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==8987==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000048 (pc 0x00000070e7b8 bp 0x7fffffffca90 sp 0x7fffffffc8c0 T0) ==8987==The signal is caused by a READ memory access. ==8987==Hint: address points to the zero page. #0 0x70e7b7 in decode_preR13_section /testcase/libredwg/src/decode_r11.c:399:15 #1 0x705d5e in decode_preR13 /testcase/libredwg/src/decode_r11.c:833:12 #2 0x53245a in dwg_decode /testcase/libredwg/src/decode.c:209:23 #3 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #4 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #5 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #6 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /testcase/libredwg/src/decode_r11.c:399:15 in decode_preR13_section ==8987==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/decode_preR13_section_np
A NULL pointer dereference exists in the function decode_preR13_section in decode_r11.c
https://api.github.com/repos/LibreDWG/libredwg/issues/486/comments
2
2022-06-07T01:27:22Z
2022-12-15T15:33:17Z
https://github.com/LibreDWG/libredwg/issues/486
1,262,607,558
486
[ "LibreDWG", "libredwg" ]
### system info Ubuntu x86_64, clang 6.0, dwg2dxf([0.12.4.4608](https://github.com/LibreDWG/libredwg/releases/tag/0.12.4.4608)) ### Command line ./programs/dwg2dxf -b -m @@ -o /dev/null ### AddressSanitizer output ==8985==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7ffff6f8bc74 bp 0x7fffffffca90 sp 0x7fffffffc1f8 T0) ==8985==The signal is caused by a READ memory access. ==8985==Hint: address points to the zero page. #0 0x7ffff6f8bc73 /build/glibc-CVJwZb/glibc-2.27/string/../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S:267 #1 0x49db15 in __interceptor_memcmp.part.75 /fuzzer/build/llvm_tools/llvm-4.0.0.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:711 #2 0x705a4d in decode_preR13 /testcase/libredwg/src/decode_r11.c:771:11 #3 0x53245a in dwg_decode /testcase/libredwg/src/decode.c:209:23 #4 0x50d759 in dwg_read_file /testcase/libredwg/src/dwg.c:254:11 #5 0x50c454 in main /testcase/libredwg/programs/dwg2dxf.c:258:15 #6 0x7ffff6e22c86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310 #7 0x419ee9 in _start (/testcase/libredwg/programs/dwg2dxf+0x419ee9) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /build/glibc-CVJwZb/glibc-2.27/string/../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S:267 ==8985==ABORTING ### poc https://gitee.com/cxlzff/fuzz-poc/raw/master/libredwg/decode_preR13_np
A NULL pointer dereference exists in the function decode_preR13 in decode_r11.c
https://api.github.com/repos/LibreDWG/libredwg/issues/485/comments
2
2022-06-07T01:24:32Z
2022-12-15T15:34:18Z
https://github.com/LibreDWG/libredwg/issues/485
1,262,606,161
485