Urgent.News

What's breaking now, across hundreds of outlets.

Tech

A 4-byte check that stopped DWG files from opening in a WebAssembly build of LibreDWG

We build a free browser viewer for engineering drawings, and one rule shaped every decision: the drawing never leaves the user's computer. Company drawings are often confidential, so opening, converting and printing all happen inside the browser tab. Nothing is uploaded unless the user chooses to send a drawing that would not open, so we can look into it. For DWG files that means running a DWG…

A 4-byte limit in a WebAssembly build of LibreDWG prevented DWG files with object handles longer than 4 bytes from opening. The issue stemmed from the pointer size being 4 bytes in WebAssembly (wasm32) as opposed to 8 bytes on a normal 64-bit build. The source code's bit_read_H function rejected handles longer than 8 bytes, but this limit was silently reduced to 4 bytes in the browser build.

The fix involved adjusting the check to 8 instead of 4. Additionally, the object map bit_read_UMC read at most 8 bytes, which was raised to 10 to accommodate 64-bit handle offsets. Lastly, the build was updated to include a DXF 999 comment indicating the modified engine version. The changes amounted to three small edits, with the entire patch available in the provided repository.

The modified engine powers AUTONEST MultiViewer, enabling users to open, measure, and annotate DWG/DXF files in the browser without installing software or sharing data. Users are advised to verify pointer size limits in their own implementations, as wasm32 pointers are 4 bytes.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Report a problem with this story

Get the day's news by email. Daily, weekly or monthly. Sign up

More in Tech

More from Thursday, 3 December 2026 →