libredwg
libredwg copied to clipboard
read_R2004_section_info out of range
Hello , i encountered a issue when converting a large (12MB) dwg file to json .
'Warning: checksum: 0x935dbb45 (calculated) CRC mismatch 0xaafa14-0xab29e5\n' + '\n' + 'ERROR: Skip section AcDb:Preview with max decompression size 0x7d20 > 0x1800\n' + 'ERROR: Skip section with size 89 > 1 * 0\n' + 'ERROR: read_R2004_section_info out of range\n' + 'Warning: Failed to find section_info[9] with type 1\n' + 'ERROR: Failed to read compressed Header section\n' + 'Warning: Failed to find section_info[9] with type 3\n' + 'ERROR: Failed to read compressed Classes section\n' + 'Warning: Failed to find section_info[9] with type 4\n' + 'ERROR: Failed to read compressed Handles section\n' + 'Warning: Failed to find section_info[9] with type 2\n' + 'ERROR: Failed to read uncompressed AuxHeader section\n' + 'ERROR: Invalid section AcDb:Preview count or max decompression size. Sections: 1, Max size: 0\n' + 'ERROR: Failed to read uncompressed Preview section\n' + 'ERROR: Template section not found\n' + '\n' + 'ERROR: Invalid num_segidx\n' + 'ERROR: Failed to decode file: /Users/somyaranjankar/Desktop/code/bbs-dwg-api/src/temp/1731333834741.dwg 0x940\n' + '\n' + 'ERROR 0x940\n'
dwgread 0.13.3.7338 is used for conversion.
- [x] read_R2004_section_info out of range
- [ ] ATTDEF with MTEXT
- [ ] Invalid FIELD.childval x 256
- [ ] ERROR: Invalid DICTIONARY.numitems 71471
- [x] object_ref realloc bug
- [ ] ERROR: Skip section AcDb:Preview with max decompression size 0x7d20 > 0x1800 looks wrong also
@rikan1 Hi, we need more information.
- You could send us the AC string from the beginning of the file.
dwgread -v3 __DWG_FILE__could help more.
@rikan1 Hi, we need more information.
- You could send us the AC string from the beginning of the file.
dwgread -v3 __DWG_FILE__could help more.
@michal-josef-spacek
we are getting this after adding "-v3"
'Reading DWG file /src/temp/1732731851358.dwg\n' + "This file's version code is: AC1027 (r2013)\n" + 'is_maint: 0x8 [RC 0]\n' + 'zero_one_or_three: 0x3 [RC 0]\n' + 'thumbnail_address: 576 [RL 0]\n' + 'dwg_version: 0x21 [RC 0]\n' + 'maint_version: 0x4 [RC 0]\n' + 'codepage: 30 [RS 0]\n' + 'ANSI_1252\n' + 'unknown_0: 0x0 [RC 0]\n' + 'app_dwg_version: 0x0 [RC 0]\n' + 'app_maint_version: 0x0 [RC 0]\n' + 'security_type: 0 [RL 0]\n' + 'rl_1c_address: 0 [RL 0]\n' +
ok, we know that is AC1027
ok, we know that is
AC1027
How to fix it? @michal-josef-spacek
@santanup I don't know what your problem is.
- The first message is:
Hello , i encountered a issue when converting a large (12MB) dwg file to json .What is the result?
- The
Warning: checksum: 0x935dbb45 (calculated) CRC mismatch 0xaafa14-0xab29e5is warning probably from system section. My example on some dwg file is
=== Read System Section (Section Page Map) @4e20 ===
section_type: 0x41630e3b [RLx 0]
decomp_data_size: 112 [RL 0]
comp_data_size: 103 [RL 0]
compression_type: 2 [RL 0]
checksum1 => 0x2099039f with seed and crc 0
checksum: 0xa8cb0e58 [RLx 0]
Warning: checksum: 0x6af11031 (calculated) CRC mismatch 0x4e34-0x4e9b
I don't know how much this is important. Probably not much in your case.
- Issue with preview section:
ERROR: Skip section AcDb:Preview with max decompression size 0x7d20 > 0x1800
I have similar issue in my file:
section_info[5] fields:
size: 15754
num_sections: 1
max_decomp_size: 16384 / 0x4000
unknown: 1
compressed: 1 (1=no, 2=yes)
type: 10
encrypted: 0 (0=no, 1=yes, 2=unknown)
name: AcDb:Preview
fixedtype: 10
ERROR: Skip section AcDb:Preview with max decompression size 0x4000 > 0x1800
Page count 1 in area 5
section[5].info[0]: AcDb:Preview type 0 => type 10
Page: 2 size: 16384 address: 0x0 info: 0x220
I don't know how much this is important. Probably not much in your case.
- Issue:
ERROR: Skip section with size 89 > 1 * 0
and probably all other. Probably related to something bad with reading of sections. My exmaple of this kind of error:
ERROR: Skip section AcDb:AcDsPrototype_1b with size 2637952 > 25 * 29696
Page count 0 in area 2
section_info[3] fields:
size: 42537356099614
num_sections: 0
max_decomp_size: 0 / 0x0
unknown: 6
compressed: 10948 (1=no, 2=yes)
type: 29696
encrypted: 0 (0=no, 1=yes, 2=unknown)
name: .
fixedtype: 0
ERROR: Skip section . with size 42537356099614 > 0 * 0
Page count 0 in area 3
section_info[4] fields:
size: 45260365365259
num_sections: 178176
max_decomp_size: 0 / 0x0
unknown: 12
compressed: 8760 (1=no, 2=yes)
type: 207872
encrypted: 0 (0=no, 1=yes, 2=unknown)
name:
fixedtype: 0
ERROR: read_R2004_section_info out of range
Warning: Failed to find section_info[4] with type 1
ERROR: Failed to read compressed Header section
Found no section_info[4] with type 9
ERROR: Failed to read uncompressed SummaryInfo section
Warning: Failed to find section_info[4] with type 3
ERROR: Failed to read compressed Classes section
Warning: Failed to find section_info[4] with type 7
ERROR: Failed to read compressed AcDbObjects section
Warning: Failed to find section_info[4] with type 2
ERROR: Failed to read uncompressed AuxHeader section
Found no section_info[4] with type 10
ERROR: Failed to read uncompressed Preview section
Found no section_info[4] with type 11
ERROR: Failed to read uncompressed AppInfo section
Found no section_info[4] with type 12
AppInfoHistory section not found
I don't know how much this is important. Probably not much in your case
What is the result? So, some section errors, and some cannot block functionality. Something is probably very bad. Without an example DWG file we cannot fix it.
What is the result? So, some section errors, and some cannot block functionality. Something is probably very bad. Without an example DWG file we cannot fix it.
@michal-josef-spacek These are the files -
- https://d2k638bldkf5wf.cloudfront.net/importDwg/1732784727769.dwg
- https://d2k638bldkf5wf.cloudfront.net/importDwg/1732784624493.dwg
@santanup Thank you. Analysis:
a) 1732784727769.dwg Version: AC1027 Created by: Teigha (be careful, Teigha has issues itself) I see errors in PROXY_OBJECTs, DICTIONARY
b) 1732784624493.dwg Version: AC1032 Created by: AutoCAD I see many errors in many entities, In AC1032 we need to fix many things.
I could export both to JSON by:
dwgread -O JSON __INPUT_DWG__ | tee __OUTPUT_JSON__
What is the root cause, which you are trying to resolve?
@santanup Could you export some of this files to DXF by AutoCAD?
Okay we will try, thanks
@michal-josef-spacek Can you please check this file . https://d2k638bldkf5wf.cloudfront.net/importDwg/1731333834741.dwg
dwgread -O JSON INPUT_DWG. This command is failing
@rikan1 Ok, this is the real issue with no possibility of reading this file.
@michal-josef-spacek How to fix this , do you have any suggestions ?
@rikan1 Check section parsing. This is not easy to do for me.
With the latest large file 1732784727769.dwg I see this internal problem:
entities[13065]: (3.4.1A1D7E78) abs:438140536 [H* 0] REALLOC dwg->object_ref vector to 32768 entities[13066]: (3.4.1A1D7E79) abs:438140537 [H* 0]Warning: Object handle not found 606492518/0x24265766
after realloc the refs, the handles cannot be found anymore. ...
The first warning checksum: 0x935dbb45 (calculated) CRC mismatch 0xaafa14-0xab29e5 is in a lot of DWG's. looks the 2nd crc algo is still wrong, but this only affects writing 2004 formats, which we cannot do yet.
ignore it.
The section info bugs are now fixed with #439 (the new decompressor) The remaining ATTDEF with MTEXT and FIELD bugs are known limitations and will be fixed later. Also the object_ref realloc bug. ERROR: Skip section AcDb:Preview with max decompression size 0x7d20 > 0x1800 looks wrong also
- The
Warning: checksum: 0x935dbb45 (calculated) CRC mismatch 0xaafa14-0xab29e5is warning probably from system section. My example on some dwg file is=== Read System Section (Section Page Map) @4e20 === section_type: 0x41630e3b [RLx 0] decomp_data_size: 112 [RL 0] comp_data_size: 103 [RL 0] compression_type: 2 [RL 0] checksum1 => 0x2099039f with seed and crc 0 checksum: 0xa8cb0e58 [RLx 0] Warning: checksum: 0x6af11031 (calculated) CRC mismatch 0x4e34-0x4e9bI don't know how much this is important. Probably not much in your case.
This was fixed with GH #1044