LibreDWG / libredwg

Official mirror of libredwg. With CI hooks and nightly releases. PR's ok
https://savannah.gnu.org/projects/libredwg/
GNU General Public License v3.0
947 stars 230 forks source link

Cannot open an autocad2022 version dwg file. #974

Closed Nico3201975 closed 5 months ago

Nico3201975 commented 5 months ago

As the description of the title.

Trying to use dwg_read_file open a dwg file created by autocad 2022.

Somehow, I got error of DWG_ERR_VALUEOUTOFBOUNDS which is 64 in interger.

But it works fine with previous versions like 2007, 2010, 2012 etc..

rurban commented 5 months ago

If you send it me, I can have look. If not, not

Nico3201975 commented 5 months ago

If you send it me, I can have look. If not, not

After looking at the demo to load a dwg file, I realized that if the error is not critical, even it's 64 but the file will still be retrieved.

But when I tried to add_fingerprint followed by the given examples, I found that dwg.header.version has to be set R_2000 ? image

Then I used current version of Autocad2018 to open this file, a window poped up and said, I need to repair this file, after clicking on it, what I have just added through "dwg_add_TEXT", those text could not be retrived anymore when the second time openinig it.

Is there a way to bypass this ? I would be much appriciated. Thanks! I am quite new to this.. :(

rurban commented 5 months ago

r2022 uses just the r2018 format, nothing new. But I found a bug in read_2004_compressed_section for the uncompressed AppInfo section: || es.fields.address + 32 + info->size > max_decomp_size is wrong and unneeded. The offset check already does that, and better

rurban commented 5 months ago

The AppInfo bug is fixed. libredwg can read r2022 just fine. For the write part, yes. we can only write up to r2000 yet, work in progress. For the recovery prompt, yes, that's expected. What's going on with the missing add_TEXT I need to have a look