libredwg icon indicating copy to clipboard operation
libredwg copied to clipboard

Issue with block table parsing in preR13

Open michal-josef-spacek opened this issue 2 years ago • 6 comments

There is issue in block table parsing in preR13 Example: BLOCK1.DXF.gz BLOCK1.DWG.gz

Actual parsing:

...
blocks   0x46c (0xfffffb94) - 0x0 (0x48, 0x80000000)
...

and code in src/decode.c:

...
error |= decode_preR13_entities (blocks_start, blocks_end,
                                 blocks_start - blocks_offset, dat, dwg);
...

This doesn't work because blocks_end is 0. We need to use block_start + modified block_offset (& 0x00ffffff)

michal-josef-spacek avatar Apr 24 '22 14:04 michal-josef-spacek

Yes, fixed in 16f6c1f97b20fd8fdec1c595e24d2fa81801afce But I dont trust the size calculation with the mask yet. I rather loop over the number of entities.

rurban avatar Apr 26 '22 06:04 rurban

@rurban Thanks. I will test. FYI: Mask works for me.

michal-josef-spacek avatar Apr 26 '22 06:04 michal-josef-spacek

yes, I re-introduced the mask, but renamed the field to size again. it's not an offset.

rurban avatar Apr 26 '22 11:04 rurban

@rurban great

michal-josef-spacek avatar Apr 26 '22 11:04 michal-josef-spacek

@rurban This change doesn't work. You added num_entities to decode_preR13_entities(), but we don't know this value from R_10. In <R_10 is in header. I believe that only thing how to do is while() and check entities_end value.

michal-josef-spacek avatar Apr 26 '22 21:04 michal-josef-spacek

Something like this: https://github.com/LibreDWG/libredwg/pull/452

michal-josef-spacek avatar Apr 27 '22 00:04 michal-josef-spacek

Fix for this issue: https://github.com/LibreDWG/libredwg/pull/559

michal-josef-spacek avatar Jan 04 '23 22:01 michal-josef-spacek