2026-03-17 Reini Urban Release 0.13.4 see NEWS build: add release helpers decode: guard optional 3DSOLID history_id handle read * src/dwg.spec (COMMON_3DSOLID): For non-DXF decode, read history_id only when version > 1 and at least 8 bits remain in hdl_dat. This avoids trailing bit_read_RC overflow reports on objects with no history_id. * src/spec.h: Add fallback AVAIL_BITS macro so spec expressions that reference it also compile in non-decoder builds. 2026-03-17 Reini Urban in_dxf: fix SubDMesh DXF binary import (GH #272) * src/in_dxf.c (in_hex2bin callers): Fix precedence bug so read gets the decoded byte count instead of a boolean. * src/in_dxf.c (add_MESH): Initialize unknown_b1/unknown_b2 defaults for DXF-imported MESH. This fixes dxf-check for Rotterdam_Centrum/Bruggen/Erasmusbrug.dwg ODA AcDbSubDMesh read errors 2026-03-17 Reini Urban Revert "decode: fix CRC check start for handle-map objects" This reverts commit e12563c5a18bd9639298306cd354ce76cc8d8342. 2026-03-17 Reini Urban spec: fix dwg_set_dataflags for TEXT/ATTRIB/ATTDEF via add API. GH #1164 When using dwg_add_TEXT/ATTRIB/ATTDEF and setting rotation or oblique_angle via the API, dwg_set_dataflags() was not called during encoding because dwg_add_empty(R_2000) sets from_version = R_2000, making the condition dat->from_version < R_2000 false. Change to <= R_2000 so the dataflags are always recomputed when encoding R_2000 output, covering both API-created objects (from_version == version) and objects whose fields were modified after decode. Applies to TEXT, ATTRIB and ATTDEF — all three share the same condition. 2026-03-17 Reini Urban decode: fix wrong memmove for LZ77 back-reference decompression. GH #1204 The #ifdef NDEBUG path used memmove() to copy compressed back-references, but memmove copies from the original source bytes. When comp_offset < comp_bytes the source and destination windows overlap and the LZ77 run-length extension requires reading back newly-written bytes as pos advances. memmove defeats this, producing wrong output in release builds. Fix: always use the byte-by-byte loop; keep the asserts under #ifndef NDEBUG. 2026-03-17 Reini Urban libredwg.spec: upgrade to 0.13.4 - Fix %{_sharedir} -> %{_datadir} (standard RPM macro) - python3-lxml already correct (switched from python3-libxml2) - SO version stays at 0.0.13 (no ABI bump in configure.ac) - Add changelog entry NEWS: add 0.13.4 release notes 2026-03-17 Reini Urban in_dxf: fix CMC color index for entity fields with DXF code >= 90 The generic entity field dispatcher treated any CMC field with DXF code >= 90 as an RGB truecolor value (pair->value.l >> 0x18 = method). But MULTILEADER uses codes 91/92/93 for line_color, text_color, block_color as plain color indices (0=ByBlock, 256=ByLayer, etc.), not RGB values. When value=0 was stored as rgb=0x00000000, ODA read method=0x00 (invalid, valid range 0xc0-0xc8), emitting "Color index 65535" and misaligning the bit-stream, triggering "CRC does not match". Fix: in the code >= 90 branch, distinguish by value: real RGB truecolors always have high byte set (> 257), so values <= 257 are color indices and are routed through dxf_set_CMC_index() for correct method/rgb. 2026-03-17 Reini Urban in_dxf: fix CMTC color method/rgb for TABLESTYLE and CellStyle color fields Add dxf_set_CMC_index() helper that properly maps a DXF color index to the CMC method and rgb bytes required by the R_2004 CMTC encoding: index 0 → 0xc1 (ByBlock), 256 → 0xc2 (ByLayer), 257 → 0xc8 (None), others → 0xc3 plus palette RGB. Previously add_TABLESTYLE and add_CellStyle only set color->index from DXF code 62, leaving method=0 and rgb=0. When SUB_FIELD_CMTC later writes those colors it forces R_2004 mode (full BS+BL+RC CMC), so rgb=0x00000000 gave ODA method=0 (invalid, valid range 0xc0–0xc8) causing "Cannot set C to that value" and a misaligned bit-stream that triggered "CRC does not match". Also fix dxf_read_CMC to compute a default method/rgb when no 420 truecolor code follows the 62 index code, using the same mapping. 2026-03-17 Reini Urban dxf-check: move oda errs to . 2026-03-16 Reini Urban build: fix codepages build with build-in-srcdir in_dxf: resolve DIMENSION.block field name to BLOCK handle The 'block' field (DXF code 2, anonymous dimension block name like '*D8') was stored in obj_hdls for deferred resolution but resolve_postponed_object_refs only handled 'block_header', not 'block'. Add 'block' alongside 'block_header' to resolve it to the BLOCK table handle, preventing duplicate anonymous blocks. in_dxf: fix phantom BLOCK_HEADER entry when new_object reuses existing object When new_object uses the 'Reuse existing BLOCK_HEADER' path it decrements dwg->num_objects, making idx >= num_objects. The outer dxf_tables_read loop then accessed a stale partial object at idx, which got an auto-assigned handle (0x47A) and was added as a phantom entry to BLOCK_CONTROL.entries, causing ODA 'Duplicate Record name (429)'. 2026-03-16 Reini Urban in_dxf: fix SORTENTSTABLE DXF import: parse ents[], sort_ents[], block_owner Handle codes 331 (ents handles), 5 (sort_ents handles), and the subsequent 330 (block_owner) for SORTENTSTABLE objects in new_object(). Fixes GH #1091: ODA 'AcDbSortentsTable can't be cast to AcDbEntity' caused by code 5 overwriting the object handle with sort_ents values. 2026-03-16 Reini Urban decode,in_dxf: fix nolinks for r2000 entity chains from DXF in_postprocess_handles sets entity nolinks=1 when the previous entity is at array index obj->index-1. But objects in the r2000 binary are written in handle-sorted order, not array order. When non-entity objects (APPID, VPORT table records) have handles between two consecutive entity handles, they appear between the entities in binary. Setting nolinks=1 makes ODA follow the binary-next object as the entity chain, which is a non-entity, causing: "Object of class AcDbRegAppTableRecord can't be cast to AcDbEntity" "Object of class AcDbViewportTableRecord can't be cast to AcDbEntity" Fix: call dwg_fixup_BLOCKS_entities after DXF import to recompute nolinks based on handle arithmetic (cur-1 / cur+1) rather than array adjacency. This clears the incorrect nolinks=1 flags and sets the explicit prev/next_entity handles that ODA requires. Fixes 2000/A.dwg and sample_2000.dwg DXF roundtrips (GH #1091). 2026-03-16 Reini Urban in_dxf: fix VX_TABLE_RECORD handle mismatch for VIEWPORT dwg_add_VX creates a VX_TABLE_RECORD and adds it to VX_CONTROL.entries using the handle returned by dwg_new_handseed. Calling dwg_new_handseed a second time and overwriting vxobj->handle.value left VX_CONTROL.entries pointing to a non-existent handle while VIEWPORT.vport_entity_header pointed to a different, skipped handle. ODA then failed to write the DXF with "Object was permanently erased". Fix: remove the second dwg_new_handseed call; use the handle that dwg_add_VX already assigned. Fixes Ceco.NET-People-Men-Sm-471.dwg DXF roundtrip (GH #1091). 2026-03-16 Reini Urban fix EED size calculation and overflows working on fixing json roundtrips for to/2000/from_uloz.to/VÝKRES_VÝZTUŽE_STROP.dwg 2026-03-16 Reini Urban common: add my_strcasecmp unit tests Compile my_strcasecmp unconditionally so it can be tested and used regardless of HAVE_STRCASECMP. The #define strcasecmp my_strcasecmp alias is still only set when the system lacks strcasecmp. Add common_strcasecmp_tests() to test/unit-testing/common_test.c Closes GH #1207 2026-03-16 Reini Urban common: fix and rename strcasecmp to my_strcasecmp Rename the fallback implementation to my_strcasecmp and add Fix the broken implementation: - Drop the bogus strcmp() shortcut (case-sensitive, useless here) - Return proper negative/0/positive instead of 0/1 - Handle strlen(a) < strlen(b) correctly via final char difference - Use (unsigned char) cast before toupper() as required by the standard GH #1207 2026-03-15 Reini Urban chore: clang-format off macros to bypass prek clang-format docs: Better AGENTS.md recipes for reprodcucers dwg.spec: relax HATCH seeds and handles dwg.spec: tolerate truncated FIELD data dwg.spec: clamp BLOCKLOOKUPPARAMETER unknown_t in_dxf: tolerate FIELD value preamble dxf-check: clear stale ODA error files 2026-03-14 Reini Urban decode: fix CRC check start for handle-map objects The per-object CRC for r13b1-r2000 handle-map objects must start after the initial MS size field. dwg_decode_add_object() used the handle-map entry address, which caused false WRONGCRC reports (notably for ES2_S_2010 XRECORD [247]). * src/decode.c (dwg_decode_add_object): Check CRC starting at obj->address-2 to match the encoder. 2026-03-14 Reini Urban dxf: avoid exporting invalid SORTENTSTABLE handle refs When exporting SORTENTSTABLE, some inputs (e.g. td/2010/ES2_S.dwg) contain NULL/zero handle references which were written to DXF as 331/5 = 0. This produces malformed DXF and breaks DXF->DWG (r2000) roundtrips, triggering invalid handles rejected by ODA. * src/out_dxf.c (VALUE_HANDLE, FIELD_HANDLE): Skip emitting DXF handle group codes 331 and 5 when the resolved absolute_ref is 0. 2026-03-14 Reini Urban in_json: make partial OBJECTS entries releasable on parse errors Fuzzed/invalid JSON can abort after json_OBJECTS already allocated object/entity containers and their payloads. With preR13 input, the free path ignored UNKNOWN_OBJ/UNKNOWN_ENT, so those allocations were not released, triggering LeakSanitizer. * src/in_json.c (json_OBJECTS): Set type/fixedtype to UNKNOWN_OBJ/UNKNOWN_ENT immediately after allocation so dwg_free can dispatch a proper free handler. * src/free.c (free_preR13_object): Handle UNKNOWN_OBJ/UNKNOWN_ENT (and DUMMY) in the preR13 switch. 2026-03-13 Reini Urban free: avoid OOB in preR13 entity cleanup with injson When reading malformed/partial JSON (DWG_OPTS_INJSON), preR13 entities may be created without initialized layer/ltype handle pointers. The preR13 free path unconditionally touched these handles, which could read past the end of the allocation under ASan. * src/free.c (free_preR13_object): Guard correct union member for entities and skip freeing preR13 entity handles for DWG_OPTS_IN inputs. Fixes ossfuzz 470417487 2026-03-13 Reini Urban docs: add AGENTS.md with repository guidance for coding agents 2026-02-11 Reini Urban fix -Wdefault-const-init-field-unsafe with clang 2026-02-10 Reini Urban dxf: encode to UTF-8 for r2007+ add a VALUE_TVc for const string literals. bit_u_expand always shrinks, but still do a copy then. @matabar also tried a fix, but his was incorrect. But thanks for the analysis! 2026-02-10 Reini Urban bits: swap wrong calloc args harmless, but be consistent spec: fix ARC_DIMENSION dxf codes 40,41 for arc_start_param and arc_end_param. See github.com/mozman/ezdxf examples_dxf/uncommon.dxf#L1434 e.g. 2026-02-06 Reini Urban switch py-libxml2 to py-lxml (#84) tested ok. 2026-02-05 Reini Urban dxf: negative color index GH #1214 also add missing the CMC method to the binary variant for consistency. 2026-02-05 Reini Urban ci: pinact run -u also ossfuzz manually: curl -s https://api.github.com/repos/google/oss-fuzz/commits/master | jq -r '.sha' 2026-02-04 Reini Urban decode: fix heap-overflow by 1 Fixes fuzzing case GH #1215, analog to ossfuzz 63483 Thanks to @Keryer (Qi Kery) json: improve color index, add Dwg_Color_Method enum See GH #1216 2026-02-03 Reini Urban codepages: add comments about exceptions and add a regen-h target oda: get deb version dynamically oda: bump to 26.12 prek: run with clang-format prek: install and changes 2025-12-17 Sakura <1178743577@qq.com> fix: memory out of bounds 2025-12-02 Reini Urban ci: pinact run -u actions/checkout@v6.0.0, codeql-action@v4.31.6 2025-11-24 luzpaz Fix various typos Found via: `codespell -q 3 -S "./.git,*.patch,ChangeLog,./NEWS,./src/codepages" -L 2rd,aadd,addd,aded,afe,ba,baed,beed,caf,childs,daa,ded,ede,fo,gir,gord,gost,nam,noo,oce,re-use,ro,siz,te,teh,tekst,ue,uptodate` 2025-11-19 Michal Josef Špaček Fix Vertex entity index4 parsing 2025-11-03 Michal Josef Špaček Fix r2007 TOLERANCE entity TOLERANCE entity need a has_strings bit. 2025-10-28 Reini Urban json: protect from NULL or wrong _obj fatal. Thanks to 7erryX (GH #1190) 2025-10-18 Reini Urban CI: bump oda to 26.9 gh: switch from -m32 to modern --host=i686-linux-gnu for latest distros 2025-09-03 Michal Josef Špaček Reini Urban Fix some REAL xdata types dwg_resbuf_value_type missed some REAL and POINT3D ranges. Fixes GH #1178 2025-09-01 Reini Urban oda: bump to 26.7 decode: fix FIELD_NUM_INSERTS Fixes GH #1177 spec: rename BLOCK_HEADER.loaded_bit to xref_loaded 2025-08-12 Reini Urban spec: use signed VERTEX_PFACE_FACE.vertind [BSd] e.g. -5 instead of 65531 2025-08-11 Reini Urban encode: fix dwg_set_dataflags oops, critical encoder bug! dataflags are reverse, if a bit is absent then the field needs to be used. also the default with_factor is 1.0 thanks to Erfan Sadigh Nejati for finding this bug. Fixes GH #1164 2025-08-10 Reini Urban configure: detect emcc and fix failing probes because of -Werror -Wlimited-postlink-optimizations Fixes the configure & make part of GH #1073 2025-08-09 Michal Josef Špaček Fix dwgadd error with bad --as version 2025-07-30 Reini Urban indxf: fix empty CLASSES GH #1068 2025-07-28 Reini Urban encode: log MLEADERSTYLE class_version: 2 taken from APPID.ACAD_MLEADERVER eed decode: fixup FIELD.value_string and format 2025-07-23 Reini Urban indxf: more FIELD improvements can now read good DXF's with FIELD's, but not yet our written FIELD's 2025-07-15 Reini Urban doc: document more VERTEX_* flags in addition to our LOG_FLAG_VERTEX rapidrtrendersettings docs and max checks. still wrong api: change LARGE_RADIAL_DIMENSION fields first_arc_pt => chord_pt leader_len => jog_angle jog_point => jog_pt ovr_center: DXF 12 => 14 indxf: add_FIELD special-cases all over. not covering all yet. 2025-07-03 Reini Urban oda: back to 26.4 26.5 disappeared gh: pinact run -u security: pin our github actions 2025-06-30 Reini Urban dynapi: fix indxf conversion from r2007+ to strings Fixes GH #1163 part 2 JSON and DXF import leaves TABLE.name as TV (i.e. UTF-8) for the future encode to r2000 oda: bump to 26.5 oda: create .dwg.err not .json.err 2025-06-25 Reini Urban encode: set TEXT.dataflags also on indxf logging: fix TV for indxf 2025-06-24 Reini Urban logging: mark T as TV api: rename SecondHeader.dwg_version to dwg_versions lo-byte dwg_version, high-byte maint_version 2025-06-23 Reini Urban indxf: fix IMAGE.imagedefreactor setter wrong dynapi usage, ref even refs dynapi: fix #lines indxf: fix IMAGE.clip_verts by defaulting num_clip_verts to 2 indxf: set BLOCK_HEADER.base_pt = BLOCK.base_pt more obj_absowner : check if rel or abs if [ -z $1 ]; then h=4 else h=$1 fi for f in *.json; do echo $f jq .FILEHEADER.version "$f" echo "ownerhandle = ($h." jq ".OBJECTS[] | select(.ownerhandle[0] == $h) | [.object, .entity]" "$f" | sort -u done 2025-06-20 Reini Urban Replace more FORMAT_RLLx with FORMAT_HV make: fix log-dwg wrong xargs syntax dxf: minor tunings write APPID 71 1 only with ADE_PROJECTION. use absolute handles with DICTIONARY 2025-06-19 Reini Urban dxf: fix *X block name resolution use the BLOCK.name not BLOCK_HEADER.name for anonymous block names. Fixes a part of GH #1091 trace: back to HEX for abs handles dwgadd: protect from missing insert block i.e. BLOCK not found api: merge R11_HANDSEED with HANDSEED also add dwg_init_handseed(), needed for some examples 2025-06-19 Reini Urban api: replace BITCODE_RLLx with BITCODE_HV for handle value. It inistally was RL, but later upgraded to RLL (64-bit long long handles). change the auxheader version from RL to HV 2025-06-19 Reini Urban indxf: fixup dwg_set_next_objhandle per default use the next HANDSEED. only for initial add_Document use dwg->next_hdl. Fixes Object of class AcDbVXTable can't be cast to AcDbBlockHeader. also set *MODEL_SPACE entmode = 2 correctly for older versions. 2025-06-18 Reini Urban indxf: VIEWPORT needs to create a matching VX_TABLE_RECORD TODO: and if the VIEWPORT is *Active, it needs to set HEADER.VX_TABLE_RECORD On LAYOUT.active_viewport 2025-06-17 Reini Urban indxf: improve VERTEX layer to use the parents layer. still not 100% correct though indxf: fix empty layer in VERTEX subents set it to the CLAYER for an immediate fix indxf: fixup find_hv logic no duplicate entries. e.g. BLOCK_HEADERs down from 31 dxf r14 roundtrip errors to 12. 2025-06-17 Reini Urban indxf: set more ownerhandles in fact for most objects take them from reactors. just not table records. this reduced the r2000 dxf roundtrip errors from 36 to 20. 2025-06-17 Reini Urban spec: remove LTYPE.unknown_r13 looks very wrong. and it's not in ODA's spec indxf: add dxf_postprocess_MLINESTYLE analog to LAYOUT. owned by a DICTIONARY, but no block_header field. strangely it is not triggered, so I added it to the reactors code also. encode: no default VX, just VX_CONTROL helps dxf roundtrips dxf-check: use $ODAFileConverter_geometry put annoying popups to the side, on X only WIP indxf: enable and fix dxf_postprocess_LAYOUT to fixup the ownerhandle vs block_header 330 confusion. BLOCK_HEADER vs DICTIONARY fixup dxf: fix LAYER.flag roundtrips no free => flag tracing 2025-06-16 Reini Urban dxf: fix LAYER.flag roundtrips flag0, linewt (wrong type), plotflag (on if plotstyle?) GH #1091 fix signed xdata ints from/to json/dxf Fixes GH #1040 encode: rename internal pvzadr to size_adr decode: trace TF and BINARY e.g. for string_area ./dxf-check sample_2000|less indxf: fix duplicate table record entries esp. with r2000. GH #1091 2025-06-15 Reini Urban indxf: fix wrong DICT.ownerhandle when there is no NOD, or NOD not at 0.1.C Fixes ODA error: Object of class AcDbBlockBegin can't be cast to AcDbDictionary GH #1159 indxf: fixup DICT.ownerhandle to NOD if NOD is elsewhere e.g. r13 dxf also fix to stable VX_CONTROL handle dxf: set more unitX_name and ratios for r13-r14 encode: write no TV-ZERO with r14 only since r2000 dxf.test: insert order for r13, r14 acad/oda add 2 INSERT's for roundtrips or whatever. dxf.test: pline order is fixed for r13, r14 insert order TODO in GH #1159 2025-06-15 Reini Urban dxf.test: add failing r14,r13 INSERT dxf conversion wrong SEQEND 2025-06-15 Reini Urban indxf: set default isbylayerlt and pspace entmode on the pspace BLOCK. See Part 5 of GH #1159 indxf: set R_13c3 because the AC1013 $ACADVER is not set in DXF indxf: add r13 table record ownerhandles only needed for r13, later they are 0. Part 4 of GH #1159 dxf: uppercase ltypes bump copyright years now checked properly indxf: comment about is_xref_ref which can be 0 dwg_api: DIMSTYLE comments for add 2025-06-13 Reini Urban decode_r11: set entmode 3 for blocks there was a wrong obj->address check, we can fake. and store it also in out_json. now some BLOCK's have no name 2025-06-13 Reini Urban preR13: fix dwg.block_control and HEADER.BLOCK_CONTROL_OBJECT missing set the ltype flag to 64 (loaded) by default. just BYBLOCK,BYLAYER are never loaded. and >r13 this bit is ignored. outdxf: fix some wrong r9 header vars some missing, and some only since r10. and fix some early defaults. from michal's new blank dxf's GH #1100 add: more preR13 defaults need VPORT.*Active since r10 already. GH #1100 add: more HEADER defaults WIP encode: fix preR13 entities iteration fix the in-BLOCK logic, but broke json-check r11/entities-3d, missing the BLOCKs GH #1100 decode_preR13: fix CLAYER double-free GH #1102, GH #1100 Fixes Missing TEXTSTYLE, CLAYER, CELTYPE and DIMSTYLE values in header dwg_add_handleref: trace re-used handleref and clean enlarged object_ordered_ref areas. trying to fix r10 CLAYER double-free add: set standard table records with r9 already GH #1100 add: set unit1_text with r10 already 2025-06-10 Reini Urban dwgadd: better --help output we can save as planned versions with dxf or json dxf-check: improve. print oda errors at the end again json-check-2000 errors: LINKRODS_from_autocad_r13.json.err STEERING_from_autocad_r13.json.err example_r14.json.er ci: bump windows-2019 to 2022 will be retired soon 2025-06-08 Reini Urban injson: eed structure comment fix dwg_add_handle ubsan: invalid negation Fixes GH #1154 bits ubsan: handle wrong negation Fixes GH #1153 0x80000000 (-2147483648) negated stays negative 2025-06-06 Reini Urban injson: fix uninitialized ptrs decode: fix UB in bsearch cmp Fixes GH #1152 2025-06-06 Michal Josef Špaček Add tests for read_MC/UMC/MS 2025-06-05 Reini Urban ci: fix PRs fixup fix add_LAYOUT 2025-06-03 Reini Urban add: fix add_LAYOUT and its test undefine NEED_VPORT_FOR_MODEL_LAYOUT, a LAYOUT can be attached to the pspace BLOCK_HEADER without a VIEWPORT. test ok now, fixes LAYOUT in GH #1137 WIP fix add LAYOUT test Attach a layout to a VPORT in mspace, not VIEWPORT. Fix the LAYOUT.block_header for this case. Set NEED_VPORT_FOR_MODEL_LAYOUT for the add LAYOUT api. See GH #1137 decode: clear new dwg->object and dwg->object_ref on realloc See GH #1045 2025-06-02 Reini Urban dynapi: fix a dwg_dynapi_entity_set_value null deref Fixes GH #1122. Fuzzing only add: set DICTIONARY.cloning to all NOD members also add: fix add_LEADER with associated_annotation analog to before. create a required DIMSTYLE before the entity. GH #1137 2025-06-01 Reini Urban add: fix add_DIMENSION first create the dimstyle, then the entity. Fixes GH #1148 indxf: fix LAYER_INDEX.numlayers realloc clear the new struct. in case of errors, the free of handle would fail. Fixes GH #1147 part 3 ci: fixup checkout for tag ci: no fetch-depth: 50, broken with tags indxf: fail on MLINE num_* setting twice with fuzzed or bad input. Fixes last part 3 of GH #1146 indxf: fix double-free in HATCH.path errors with fuzzed or bad input. Fixes part 2 of GH #1146 2025-05-31 Reini Urban ci: Update oda version indxf: fix failed dxf_read_rll when no number can be read, set the number to 0. Fixes GH #1146 injson: fix NULL in_hex2bin argument Fixes GH #1142 add_test: add oda check with LIBREDWG_DEBUG 2 passes 2025-05-26 Reini Urban encode: always compute the HANDSEED dont take anything granted. Fixes GH #1127 (part of GH #1105) 2025-05-23 Reini Urban adjust MAX_SIZE_BUF on ASAN See GH #1144 indxf: protect calloc failures set the counter to 0 Fixes fuzzing null-deref GH #1141 2025-05-21 Reini Urban injson: fix uninit access on missing FILEHEADER.version/dwg_version Fixes uninitialized/2/testcase by Matteo Marini. 2025-05-20 Reini Urban indxf: fix invalid LAYER_INDEX.entries a Matteo Marini testcase submitted privately (uninitialized/1) 2025-05-13 Reini Urban tests: rename $TeighaFileConverter to $ODAFileConverter silence ODAFileConverter_geometry popups on X .profile: export ODAFileConverter_geometry="-geometry 150x150+0-0" gitignore local helper scripts build-aux/clang-format-all.sh src include test/unit-testing/ dynapi: fix regen indentation Fixes GH #1136 and conforms to clang-format fix distclean: clean dxf.err leftovers and remove dynapi_test.c target, which is really for build_dir but have no .c in build_dir. fix git-version-gen by fetching more commits and tags. since we always tag builds via appveyor, depth 50 should be enough to catch such a tag. add library version api So that other programs can inspect the version parts. Fixes GH #1133 2025-05-12 Reini Urban update TODO: pre-R13 remove unused vars detected by clang-cl config.rpath: egrep -> grep -E 2025-05-12 Reini Urban extend git-version-gen to NEWS parsing single LIBREDWG_SO_VERSION source move from dwg.h back to configure.ac grep this for cmake bump VERSION_MINOR to 13 2025-05-03 Reini Urban decode: fix dat.chain double-free the chain may be reallocated but is copied. e.g in solid_background 2025-05-02 Reini Urban dxf: don't split utf-8 sequences, cquote all Fixes rest of GH #986 debug: add all missing unhandled types unit-testing: more coverages for SOLID_BACKGROUND, GEODATA, LARGE_RADIAL_DIMENSION. not distributed, but public samples. 2025-04-30 Reini Urban encode: wrong __counted_by optimizations with eed and some additional fields before the final char[]. fails with gcc-15 and esp. with mingw. wrong memcpy **buffer overflow** warnings. indxf: explicit realloc(0) to free detected with valgrind decode_preR13: better GH #1131 protection also with the 2 other wrong sizes. CiFuzzer detected still an OOM decode_preR13: protect from illegal header.entities_end also abort when decoding a single entity makes no progress, due to overflow. Fuzzed in GH #1131 2025-04-22 Michal Josef Špaček Fix hardcoded HANDSEED value for AC1015 DWG file In DWG AC1015 is more handles than 0x25, there were conflict. Fix DWG file format It's breaker for opening in AutoCAD R14, AutoCAD 2000. 2025-04-22 Reini Urban fix dwg_section_page_checksum usage need to do this for every section on encode. first the header weith a zero'd checksum field to get the seed for the body. Fixes GH #1044 2025-04-20 Reini Urban decode_test: tcc does not zero structs 2025-04-20 Michal Josef Špaček Fix encoding of LAYER table flag0 Add default value for LAYER table linewt variable Fix LAYER table boolean values 2025-04-19 Reini Urban decode: windows/msvc portability quirks 2025-04-18 Reini Urban decode: skip old section checks which break now 2004/Leader, 2018/Leader, ... decode_test: new decompression unit tests change/extend bit_explore_chain decode: fix encrypted_section_header.unknown wrong ODA specs. decode read_R2004_section_info refactoring use FIELDs and dec streams. refactor 2004 decompression See GH #439 for the decompression bug analysis. Simplify to use our bit chains fix PRI_SIZE_T_MODIFIER on 32bit and windows 2025-04-17 Reini Urban decode: remove some DEBUG checks decomp: sync -v9 decompress logging with work/decomp-gh439 count position from 0, not the end 2025-04-11 Reini Urban DEBUG decompression sections 2025-04-11 Michal Josef Špaček Fix ellipse drawing in SVG Fix SVG rotate syntax 2025-04-05 Reini Urban reedsolomon: fix DEBUG code decode: fix eed DEBUG sanity checks 2025-04-05 Michal Josef Špaček Log decrypted R2004 header Change logging of decrypted block to LOG_TF_HEX Split LOG_TF to LOG_TF_HEX and rest 2025-04-04 Reini Urban mingw: update python2 to mingw-w64-x86_64-python mingw-w64-x86_64-python3 is now a virtual package provided by mingw-w64-x86_64-python mingw-w64-x86_64-python2 is gone. 2025-04-04 Daniel Nikolov <114946180+danikolovv@users.noreply.github.com> fix docs: Functions Decoding change first and second example. process_BLOCK_HEADER (block_control->entries[i]); 2025-03-22 Michal Josef Špaček BLOCK_RECORD isn't present in AC1009 DXF 2025-03-22 Michal Josef Špaček Fix DXF defaults for AC1009 Main issue is PUCSXDIR/PUCSYDIR with value (0.0, 0.0, 0.0) which is invalid in AutoCAD. These values are present from AutoCAD R11. HANDSEED is present from AutoCAD R10. The oldCECOLOR_lo is present in range R1.5 and R12 2025-03-14 Reini Urban ci: add --enable-debug build step but no make check. Fixes GH #1098 dxf: fix --enable-debug compilation Fixes GH #1095 2025-03-13 Michal Josef Špaček Fix logging of classes Similar output as latest DWG format. Before the commit: =======> Classes (start): 13739 Classes (end) : 15146 Length : 1407 Size : 1369 [RL] number: 500 [BS] proxyflag: 0 [BS] appname: ObjectDBX Classes [TV] cppname: AcDbPolyline [TV] dxfname: LWPOLYLINE [TV] is_zombie: 0 [B] item_class_id: 498 [BS] number: 501 [BS] proxyflag: 32768 [BS] is R13 format proxy (32768) appname: ObjectDBX Classes [TV] cppname: AcDbHatch [TV] dxfname: HATCH [TV] is_zombie: 0 [B] item_class_id: 498 [BS] After the commit: =======> Classes (start): 13739 Classes (end) : 15146 Length : 1407 Size : 1369 [RL] ------------------- Number: 500 [BS] Proxyflag: 0 [BS] Application name: "ObjectDBX Classes" [TV] C++ class name: AcDbPolyline [TV] DXF record name: LWPOLYLINE [TV] is_zombie: 0 [B] item_class_id: 498 [BS] ------------------- Number: 501 [BS] Proxyflag: 32768 [BS] is R13 format proxy (32768) Application name: "ObjectDBX Classes" [TV] C++ class name: AcDbHatch [TV] DXF record name: HATCH [TV] is_zombie: 0 [B] item_class_id: 498 [BS] 2025-03-13 Michal Josef Špaček Remove error in check by bit_read_H() -1 means one byte for first bit_read_RC() in bit_read_H(). Before patch: --common_size: 718 proxy_id: 515 [BL 90] dwg_versions: 0x19 [BLx 95] > maint_version: 0 > dwg_version: 19 from_dxf: 0 [B 70] > data_numbits: 2325 [ 93] 9094D65747269633530004B34000000600000000000000002881000000180000000000000000A202229258409E5840A25840A65840B05840B4000000000000001220233000000180009940000006000000000000000028800000000000000A2 objids[0] = (5.1.F) abs:15 [H] [add handleref (5.0.0) abs:0] objids[1] = (5.0.0) abs:0 [H] [add handleref (5.1.14) abs:20] objids[2] = (5.1.14) abs:20 [H] [add handleref (5.1.F) abs:15] objids[3] = (5.1.F) abs:15 [H] ERROR: bit_read_RC buffer overflow at 403.2 + 1 > 404 num_objids: 4 padding: +6 object_map{5C77} = 117 padding: FF/3F (6 bits) crc: 2EFA [RSx] check_CRC 993626-994032 = 406: 2EFA == 2EFA After patch: --common_size: 718 proxy_id: 515 [BL 90] dwg_versions: 0x19 [BLx 95] > maint_version: 0 > dwg_version: 19 from_dxf: 0 [B 70] > data_numbits: 2325 [ 93] 9094D65747269633530004B34000000600000000000000002881000000180000000000000000A202229258409E5840A25840A65840B05840B4000000000000001220233000000180009940000006000000000000000028800000000000000A2 objids[0] = (5.1.F) abs:15 [H] [add handleref (5.0.0) abs:0] objids[1] = (5.0.0) abs:0 [H] [add handleref (5.1.14) abs:20] objids[2] = (5.1.14) abs:20 [H] [add handleref (5.1.F) abs:15] objids[3] = (5.1.F) abs:15 [H] num_objids: 4 padding: +6 object_map{5C77} = 117 padding: FF/3F (6 bits) crc: 2EFA [RSx] check_CRC 993626-994032 = 406: 2EFA == 2EFA 2025-03-12 Reini Urban more PROXY specs add and fix combined dwg_versions field. add graphical proxy_data fields. (ent only) 2025-03-10 Reini Urban dxf: write TABLESTYLE out_dxf: also use PROXY objids code and for in_dxf: PUSH_HV already logs in_dxf: more PROXY objids 2025-03-08 Reini Urban spec: refactor PROXY_{OBJECT,ENTITY} rename class_id to proxy_id add class_id as 91 rename version to dwg_version, fix its DXF representation 2025-03-06 Reini Urban decode: less -v3 crc logging for easier json-check -v3 diffs dxf-check: improve use the test dir, not to override our dxf's and use the right .err file. in_dxf: fix DIMSTYLE code 5 to resolve DIMBLK, and not set the handle encode: improve section_order_trace max numsections 2025-03-05 Reini Urban dxf: dont write LAYER 370 0 PUSH_HV: dont push duplicate refs dxf: trace ownerhandle 330 which was wrong in some r13 files dxf: TABLE_WRITE_FIXUP_NUMENTRIES skip empty tables for the TABLE_CONTROL.num_entries DXF output (70) See GH #1091 dxf: UCSXORI and HANDSEED are r10 only not r9 dxf-check: use ./dxf -o because ./dxf mangles even the basename. so we can continue with the ODA checks. dxf.test: dirname fixups in ODA roundtrip test 2025-03-03 Reini Urban dxf.test: more ODA roundtrip tests for in_dxf GH #1085 dxf tests: oda can only write r12+ DWGs dxf: revise add ".0" for negative numbers GH #1083 dxf: AcDbSpatialIndex is ODBX_OR_A2000CLASS but not version dependent. rather randomly add ODAFileConverter probe and use it in dxf.test and dwgadd_test.sh ci: add gjv, a geojson validator ci: install missing latexml and fixed relaxng-svg11 Needed for svg validation with --enable-release. Fixes GH #1088 2025-03-03 Michal Josef Špaček Add ".0" to BD, RD fields if not present The result is similar as from AutoCAD. It helps with naive diff between AutoCAD outputs and DXF outputs from LibreDWG. 2025-02-28 Michal Josef Špaček Fix VPORT.UCSICON in DXF output and input The values 1 and 2 of UCSICON are swapped between DWG and DXF representation. There are another values 0 and 3 which are valid. 2025-02-28 Reini Urban add: fixup add_POLYLINE_3D and add more LOG_ERROR Out of memory encode: fix last vertex -> seqend: next_entity must be 0 fix IN_POSTPROCESS_SEQEND. Major: Fixes arg confusion, needs the SEQEND obj, not the owner. Fixes GH #1086 2025-02-27 Reini Urban add oda checks to dwgadd_test.sh GH #1065 2025-02-27 Michal Josef Špaček Fix $BLIPMODE in DXF output $BLIPMODE is present in DXF in add: fix wrong examples cross-checked with oda. See GH #1065 outdxf: fix old LTYPE oda error: Invalid index out_dxf: fix empty $DIMBLK and other empty VALUE_TFF. found via dxf-roundtrip 2025-02-25 Reini Urban gh: re-enable oda download 2025-02-23 Reini Urban spec: rename LAYER.on to LAYER.off See GH #1080 2025-02-21 Reini Urban fix r14 LAYER.on Fixes GH #1080 2025-02-20 Reini Urban unit-tests: wrong attdef errormsg but still crashes for me with to/2018/from_ACadSharp/AecObjects.dwg spec: simplify LAYER free logging 2025-02-20 Michal Josef Špaček Fix layer logging in Free section 2025-02-14 Reini Urban fix actions/upload-artifact 2025-02-14 Michal Josef Špaček Fix LAYER 62 DXF output in case of disabled layer If the layer is disabled, color has negative value. Add logging of flag0 bits in LAYER Fix presence of LAYER 290 in DXF output Field 290 is presenting in case of 0 only. Fix indexes in LAYER 70 DXF output GH#1077 2024-12-24 aled-ua Fix vuln OSV-2024-384 2024-12-12 Reini Urban dynapi_test: improve finding the tests from an extra builddir 2024-12-08 Reini Urban fix more C++ regressions m4: fix clang++ compilation which failed with -Wdeprecated in AX_PRINTF_SIZE_T 2024-12-08 Reini Urban indxf: __counted_by() and -Warray-bounds with flex. EED struct use __counted_by__ attribute and -fstrict-flex-arrays=3 since gcc-15 and clang-18. 2024-12-08 Reini Urban dynapi: parse SUB_FIELD_VECTOR dxf codes 2024-12-08 Michal Josef Špaček Fix BLOCKSTRETCHACTION object codes Part of GH#1054 Revised by Reini Urban 2024-12-06 Michal Josef Špaček Fix BLOCKSTRETCHACTION situation after handles Last fix was wrong. Each handle could have zero, one or more indexes. Fixes GH#1053 2024-12-01 Michal Josef Špaček Fix HATCH entity Fixes GH#1047 Tested on example in issue. 2024-12-01 Michal Josef Špaček Fix tests Fix BLOCKSTRETCHACTION handles Fixes GH#1049 2024-11-19 Michal Josef Špaček Fix signed ints Fixes Windows conversion of AuxHeader->minus_1 2024-10-15 Reini Urban debug: add NanoSPDS classes dxf<->cpp names and regen dynapi debug: fix GEOPOSITIONMARKER spec and test. no coverage still 2024-10-13 Reini Urban spec: refactor AcDbMTextObjectEmbedded to SUBCLASS functions can return errors, and we can still continue outside the subclass. 2024-10-10 Reini Urban unknown: add ATTDEF with MTEXT bits 2024-10-08 Reini Urban spec: ATTDEF refactor, re-use AcDbMTextObjectEmbedded as embedded subclass for ATTRIB, ATTDEF, GEOPOSITIONMARKER. Very similar to MTEXTOBJECTCONTEXTDATA. 2024-10-06 Reini Urban spec: more attdef, attrib changes names now from the official adesk dxf specs ("secondary"). there's only AecObjects_from_ACadSharp_2018 spec: change some ATTRIB fields analog 2024-10-05 Reini Urban spec: change some ATTDEF fields See https://github.com/ixmilia/dxf-rs/blob/main/spec/EntitiesSpec.xml dxf: more MIF types in dxf_fixup_string document ELLIPSE fields and more. from the ODA SDK change ARCALIGNEDTEXT field names See https://github.com/ixmilia/dxf-rs/blob/main/spec/EntitiesSpec.xml 2024-10-04 Reini Urban dxf: fix dxf_fixup_string logic Fixes most parts of GH #986 (thanks to @vagran/Artyom Lebedev). Remaining is proper utf8-len splitting. not 250 bytes but runes. This needs to be done by converting overlong strings to UCS-2, split them at 250 and then output them as UTF-8. 2024-10-04 Reini Urban more missing final \n in stderr prints dwgwrite: missing \n in Unknown DWG header.from_version confusing whitespace missing: *ATTRIBUTE_MALLOC indxf: fix ubsan errors, NULL strings and failing alloc Fixes GH #1007 2024-09-30 Reini Urban escape: fix error: null destination pointer 2024-09-29 Reini Urban bump pslib to 0.4.8 now with -lm needed 2024-09-28 Reini Urban mips: wrong -Werror=maybe-uninitialized warnings with gcc-12-mips-linux-gnu 12.3.0-17ubuntu1cross3 define MAX_SIZE_BUF esp. for asan: allocation-size-too-big which is harmless, but throws a better error msg in add_ent_preview for a BLL. Fixes GH #1006, fuzzing DXF input indxf: check invalid preview_size Fixes GH #1006, fuzzing invalid DXF input bits: extend BLL tests, fix write_BLL fix test leaks. bits: fix bit_read_BLL esp. for preview_size fixes the MESH problems from GH #1019 2024-09-21 Michal Josef Špaček Improve angle logging Previous in LTYPE table: dashes[3].length: -0.2 [BD 49] dashes[3].complex_shapecode: 4 [BS 75] dashes[rcount1].style: (5.1.10) abs:16 [H 340] => STYLE STANDARD dashes[3].x_offset: 0 [RD 44] dashes[3].y_offset: 0 [RD 45] dashes[3].scale: 0.1 [BD 46] dashes[rcount1].rotation: 1.5708 [BD 50] 90º ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dashes[3].shape_flag: 3 [BS 74] ABS_ROTATION(0x1) IS_TEXT(0x2) After change: dashes[3].length: -0.2 [BD 49] dashes[3].complex_shapecode: 4 [BS 75] dashes[rcount1].style: (5.1.10) abs:16 [H 340] => STYLE STANDARD dashes[3].x_offset: 0 [RD 44] dashes[3].y_offset: 0 [RD 45] dashes[3].scale: 0.1 [BD 46] dashes[3].rotation: 1.5708 [BD 50] 90º ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dashes[3].shape_flag: 3 [BS 74] ABS_ROTATION(0x1) IS_TEXT(0x2) 2024-09-20 Michal Josef Špaček Fix LTYPE logging Maximum number if 1 (ABS_ROTATION) + 4 (IS_SHAPE) 2024-09-20 Reini Urban doc: ODA spec patches for LTYPE 2024-09-17 Reini Urban oda: switch to self-hosted oda: bump ODAFileConverter for gh action to 25.7 but is not free to download anymore, needs an account. dwgadd: fix read* logic, add tests Fixes GH #1008. This broke with the refactoring for 0.13 Thanks to @khlukekim for the report 2024-08-16 Reini Urban encode: also disable LAYER.material dxf: fix int to unsigned short promotion with -Wformat on apple m2. Fixes GH #1001 dxf: resolve empty BLOCK.name which is mandatory in DXF. Fixes GH #999 2024-08-16 Michal Josef Špaček Fix compilation of 3DSOLID_materials in debug mode 2024-08-16 Reini Urban spec: fix BLOCKSTRETCHACTION_handles.long1 type Thanks to @billydotzhang, fixes GH #1001 2024-07-31 Michal Josef Špaček Fix autogen.sh There is situation after clone from git repository. .tarball-version doesn't exists in this time. 2024-07-27 Reini Urban encode: more disable_3DSOLID_materials disable materials in 3DSOLIDs and all its subtypes. GH #954 2024-07-13 Reini Urban api: promote WIPEOUT back to stable Lets see if encoded WIPEOUT still cause redraw crashes (GH #244) 2024-07-10 Reini Urban dwgadd: fix FMT_ANY on windows with sscanf_s. text, attrib and such are now working 2024-07-09 Reini Urban more -Wno-alloc-size configure and cmake. failed on mingw. actions: bump to ilammy/msvc-dev-cmd@v1 node 20 actions: bump to actions/upload-artifact@v4 and fix mingw-failure.tgz artifact actions: use hendrikmuhs/ccache-action with ccache and cache 2024-07-07 Reini Urban dwg_section_type: cosmetics oda: bump to ODAFileConverter-25.5.0.0-1 actions: bump to actions/setup-python@v5 v4 is deprecated, node 16 -> 20 2024-07-06 Reini Urban api: rename IMAGE.size to image_size because of json clashes. Helps also GH #954 cmake: set -Wno-error=alloc-size needed for in_dxf msvc: set /utf-8 option Fixes GH #988 2024-07-05 Reini Urban decode_r2007: fix invalid section name_length Only with invalid dwgs, fuzzing GH #989 encode: fix scale_flag: 1 (INSERT DD 41) Fixes GH #990. With scale_flag 1 we must not write scale.x 2024-06-15 Reini Urban .clang-format: help fmt 2024-06-14 Reini Urban dwggrep: fix usage, add -n for --tables Fixes GH #982 2024-06-02 Reini Urban clang-format-all src AUTHORS: add Gong Xiangyang 2024-06-02 gongxy <83904580@qq.com> Optimize dwg_add_Handleref 2024-06-02 Reini Urban Revert "compcert: fix use of undeclared identifier __FUNCTION__" Apparently compcert defines __FILE__ and __LINE__ just fine. Just have to find out how. This reverts commit 989c8dcf3b174336ec16f9161b6c77abb5639c21. 2024-06-02 Michal Josef Špaček Add test data for R2000 The *scr files are the 2d/3d entity sets and the DWG/DXF files are the script command output in R2000. 2024-05-02 Reini Urban gh actions: faster codecov -O0 indxf: fix ent.310 double free freshly allocate a dxf string for dwg_dynapi_common_set_value() Fixes ossfuzz 66109 gh action: continue in codecov upload error 2024-05-01 Reini Urban compcert: no duplicate __attribute_deprecated_msg__ definition 2024-05-01 Reini Urban compcert: fix use of undeclared identifier __FUNCTION__ a compiler extension. Only half-way through: compcert throws Fatal error: uncaught exception Stack overflow Raised by primitive operation at Debugvar.join.join2 in file "extraction/Debugvar.ml", line 196, characters 36-57 even with all __FUNCTION__ removed. But still good to catch C11 extensions, like anonymous structs/unions (which are also problematic for tcc dwarf support). Usage: ../configure 'CC=ccomp -v -fstruct-passing -flongdouble -std=c11' --disable-bindings --disable-werror && make 2024-05-01 Reini Urban gh actions: use secret.CODECOV_TOKEN codecov: codecov.io upload may fail or timeout dwg: name Dwg_R200*_Header anon union API breaker. Fixes GH #966 (-Wpedantic), GH #867 (compcert and -Wc11-extension) and probably tcc debugging. codecov: fixup codecov_io.sh from libtool .libs 2024-04-30 Reini Urban appveyor: cygwin -Werror __XSI_VISIBLE redefined __nonnull_all redefined appveyor: target not found: mingw-w64-i686-perl decode: wrong read_2004_compressed_section check Fixes GH #974 2024-04-27 Reini Urban remove AC_DISABLE_STATIC again why did I add this? with deebe761059f5a845 when updating to autoconf 2.71 it breaks macOS builds. and static progs are fine for me, even if huge. we still should support --en/disable-shared and --en/disable-static. fix macos gh actions deps 2024-04-27 Reini Urban bit_read_H: cap handles at 64, not 32 bit Fixes GH #967. Thanks Michal for the r2000 example. 2024-04-15 Reini Urban encode: even more wrong bit_chain_alloc usages encode: more wrong bit_chain_alloc usages 2024-04-14 Reini Urban encode: fix copy_R2004_section overflow check was completely wrong. Fixes oss-fuzz 63824 encode: protect more in_postprocess_SEQEND NULL-derefs e.g. oss-fuzz 68030 2024-04-03 Michal Josef Špaček Remove if in DICTIONARYWDFLT Variables are in all DXFs where is DICTIONARYWDFLT object. Fix DICTIONARYWDFLT object In R13, R14, R2000 DWG files is same structure. 2024-03-30 Michal Josef Špaček Add logging of ATTDEF flags in R14 2024-03-28 Michal Josef Špaček Log mlinestyle flag 2024-03-26 Michal Josef Špaček Log style FLAG 2024-03-20 Reini Urban encode: convert xdata TV from utf8 also Fixes GH #873 2024-03-19 Reini Urban bits: convert TV from utf8 back to codepage when imported from JSON. Fixes GH #873 2024-03-19 Michal Josef Špaček Fix spaces in logging of SPLINE scenario Actually: scenario: 2 [BL 0] BEZIER(0x2) After: scenario: 2 [BL 0] BEZIER(0x2) 2024-03-19 Michal Josef Špaček Log LTYPE shape flag Fix ltype dashes on R13 Improve logging of text dashes 2024-03-18 Reini Urban dwg_api: relax invalid name checks only warn, no error dwg_is_valid_name_u8: less code codepages: add is_valid_name u8 API and tests with the u8 and native API. add and in_json needs u8, the rest native. single and multibyte, TV and TU. 2024-03-18 Reini Urban codepages: add dwg_codepage_isalnum for all the codepages. except utf8, utf16 which falls back to iswalnum(). we really dont want to switch locale back and forth just to use the broken system libc isalnum() api. at least windows would have a is*_l variant. for chars under 128 we just refer to libc isalnum(), and our alnum tables ignore them. Fixes GH #958 2024-03-18 Reini Urban gh: fix sanitizer issue gh: skip broken sanitize run-time for a while See https://github.com/actions/runner-images/issues/9491 2024-03-17 Reini Urban gh: sanitize with -O1, use contains substring checks. 2024-03-16 Reini Urban oda: update to 25.1 GTAGS: add gtags.files for a much smaller proper GPATH file bits: fix bit_utf8_to_TU off-by-one, and no test coverage! Fixes GH #959 2024-03-16 Michal Josef Špaček Improve vector logging New one in MLINE: verts[0].vertex: (-1.20008e+06, -800053, 0) [3BD 11] verts[0].vertex_direction: (1, 0, 0) [3BD 12] verts[0].miter_direction: (2.22045e-16, 1, 0) [3BD 13] verts[0].lines[0].num_segparms: 2 [BS 74] verts[0].lines[0].segparms[0]: 0 [BD 41] verts[0].lines[0].segparms[1]: 0 [BD 41] verts[0].lines[0].num_areafillparms: 0 [BS 75] verts[0].lines[1].num_segparms: 2 [BS 74] verts[0].lines[1].segparms[0]: 0 [BD 41] verts[0].lines[1].segparms[1]: 0 [BD 41] verts[0].lines[1].num_areafillparms: 0 [BS 75] verts[1].vertex: (-1.20008e+06, -800053, 0) [3BD 11] verts[1].vertex_direction: (1, 0, 0) [3BD 12] verts[1].miter_direction: (2.22045e-16, 1, 0) [3BD 13] verts[1].lines[0].num_segparms: 2 [BS 74] verts[1].lines[0].segparms[0]: 0 [BD 41] verts[1].lines[0].segparms[1]: 0 [BD 41] verts[1].lines[0].num_areafillparms: 0 [BS 75] verts[1].lines[1].num_segparms: 2 [BS 74] verts[1].lines[1].segparms[0]: 0 [BD 41] verts[1].lines[1].segparms[1]: 0 [BD 41] verts[1].lines[1].num_areafillparms: 0 [BS 75] Affected lines with segparms. Previously something: verts[rcount1].lines[rcount2].segparms[0]: 0 [BD 41] 2024-03-11 Reini Urban configure: fix test: too many arguments configure: support --disable-docs because texlive is huge, and it is only needed for releases. Fixes GH #839 feature request 2024-03-10 Michal Josef Špaček Fix setting of ltype to entity For case if ref doesn't defined 2024-03-10 Reini Urban dwgadd: block adds the BLOCK_HEADER also and check for valid names before dwg_api: fix non_null's add: reject invalid table names See also GH #949 dwg_api: make most obj,ent args mandatory Helps GH #949 (untested) dwg_api: add dwg_ent_set_ltype by name, not by handle. easier to check the 3 builtin tablerecords 2024-03-10 Reini Urban print: fix VALUE_RS type confusion 0 is int, not short. But C doesn't know numeric literals shorter than int, so the new Apple M1 clang is overly strict. Fixes GH #951, -Werror,-Wformat on the M1 2024-03-10 Reini Urban spec: fix BLOCKSTRETCHACTION.hdls[].longs type Thanks to @romanjlewis in GH #951 GH actions: ninja should already be installed I think 2024-03-10 Michal Josef Špaček Fix RLL which is longlong Add missing FIELD_RCd, used in second header 2024-03-09 Reini Urban injson: fix some windows long nonsense use uint32_t instead (BITCODE_BL). Fixes GH #943 json: fix signed ints Fixes 2 cases of GH #943 2024-03-03 Michal Josef Špaček Fix warning with sections header.sections is 0 header.num_sections is right number to check 2024-02-26 Reini Urban doc: ODA spec patches indxf: log COMMON TF as string such as COMMON.preview dxf.test: MINSERT is silently skipped on r13 and MULTILEADER on r14. Enable r14 dxf.test Fixes GH #342 README: add dwgadd Release 0.13.3 esp. for the missing dwg2ps.1 Full history from the git log ----------------------------- 2024-02-26 Reini Urban Release 0.13.3 dist: check for dwg2ps.1 and dwgadd.1 explicitly The examples manpages were missing. See GH #941 2024-02-21 Reini Urban in_dxf: comment, can read binary dxf also 2024-02-20 Reini Urban indxf: fix HATCH null-deref Fixes oss-fuzz 66843 indxf: fix UAF Fixes oss-fuzz 66835 2024-02-16 Reini Urban spec: debug uncertainties in BLOCKSTRETCHACTION_handles unknown: use strEQ macros unknown: fix pi_fn vbase for libtool'd unknown in the .build-debug/examples/.libs subdir spec: add BLOCKSTRETCHACTION subclasses support dxf_test for array of structs with primitive types (BLOCKSTRETCHACTION_codes*) 2024-02-15 Reini Urban unknown: add 10xx fields, which are not EED mostly log_unknown_dxf: more enhanced BLOCK fields github: bump actions/checkout@v4 "Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3" dxf_test: now we have longer paths encode: wrong DWG_MAX_OBJSIZE introduced for fuzzing, but STEERING_from_autocad_r13.dwg has a larger 3DSOLID spec: promote SUN object to stable spec: update coverage comments after running unknown with the new dwg/dxf pairs. several objects do look very stable though, such as some AcDbBlock1PtParameter objects: BLOCKBASEPOINTPARAMETER, BLOCKLOOKUPPARAMETER, BLOCKPOINTPARAMETER. unknown: fix num_classes calc we need to compare by value, not pointer, as the unknown_dxf[i].name strings are distinct unknown: regen alldxf incs with test-old dxfs unknown: regen alldwg.inc with test-old dxfs unknown: EVALUATION_GRAPH is UNSTABLE not DEBUG anymore. regen the unknown inc's via full-regen-unknown. test-old DWG/DXF pairs not yet included. 2024-02-14 Reini Urban spec updates Note: opensuse seperates it into -tools and 0 make dist: fail releasing on missing libps Fixes GH #941 add build-aux/install-pslib to --enable-release Fixes GH #941 indxf: fix OLE2FRAME.data [310] initial case Also fixes ossfuzz 66639 2024-02-13 Michal Josef Špaček Fix typo 2024-02-11 Reini Urban encode: fix uninit old_data segv esp. on downconverting. OUT=0 VER=13 examples/llvmfuzz_standalone ../test/test-data/DS_libereco_R2007.dwg support beta VERSIONs, no holes Fixes GH #908 2024-02-10 Reini Urban Release 0.13.2 check make dist for missing subdirs See GH #937 2024-02-10 Reini Urban github: fix make release, no extra python install missing python3-libxml2 and libxslt See GH #937 add install-libxslt helper, needed for the python libxml2 package if installed extra. 2024-02-09 Reini Urban Release 0.13.1 A bugfix release, with one minor feature dwgread .min.json added. See NEWS NEWS: Fixed SummaryInfo.props[].tag and value types to T16 2024-02-09 Michal Josef Špaček Fix summaryinfo props 2024-02-09 Reini Urban decode_r11: update HANDSEED on new handles Fixes decoding and roundtrips of e.g. r11/from_autocad_r12/sample/BASEPLAT.DWG esp. on ctrl entries. 2024-02-09 Michal Josef Špaček Fix comments of ObjFreeSpace and SecondHeader 2024-02-08 Reini Urban bits: write only 4 byte handles on error bits: sizeof bits union may be 16 detected by cppcheck. not sure which compiler actually does such things, but keep it the specs bits: fix leak detected by cppcheck decode_r11: accept 1 missing byte esp. with TEXT entities. eg from_autocad_2.62/MENUTREE.DWG there might be one more unknown byte decode: cap handles at 32bit Fixes GH #935, which has a r2000 example which has an undocumented high bit set in most handles. In fact, searching found no examples with more then 4 byte handles. json-check: use min.json dwg: support .min.json json: support -m json: option DWG_OPTS_MINIMAL for minJSON (minimized) no whitespace at run-time. We don't write minimal JSON as with minimal DXFs anymore ($ACADVER, $HANDSEED, and then ENTITIES only). With ideas from GH #886 2024-02-07 Reini Urban injson/dxf: fix LTYPE.numdashes setter ERROR: Unknown num_dashes field encode: fix downconvert_DIMSTYLE when the eed already had one member, AcadAnnotative. e.g. ../to/2013/from_github_santicastro/Triskele_centered_with_connectors_extract.dwg 2024-02-06 Reini Urban Prepare 0.13.1 bugfix release 2024-02-06 Reini Urban indxf: add add_sub_ASSOCDEPENDENCY for the 2 special classes ASSOCGEOMDEPENDENCY or ASSOCVALUEDEPENDENCY. add SUB_FIELD_* parsers, which need o for the field ptr, and f for its type. Fixes ASSOCGEOMDEPENDENCY dxf import with example_2000 (which was suppoed to be stable) 2024-02-06 Reini Urban dynapi: add dwg_dynapi_subclass_set_value needed for indxf. can also be used for injson gen-dynapi: fix ASSOCGEOMDEPENDENCY subclass and fixup the lines for debugging dxfb-check: harmonize with dxf-check encode: fix ERROR: Wrong object size on MS adjust when the new size doesnt fit the old MS size (overlarge MS size), we move the stream by 2, but forgot to adjust the end_address calc, leading to wrong ERROR: Wrong object size and CRC calc XRECORD.cloning logging: print the DXF code distcheck: cleanup check_oda files so far only locally json.test: print the right ODAFileConverter name as with json-check 2024-02-05 Reini Urban dxf.test: except skipped r13 LIGHT entity which must be skipped in r13 DXFs spec: improve PROXY fields and dxf codes but still cannot roundtrip indxf: fix xdata_size with BINARY outdxf: fix BINARY esp. for 310 xdata fields, with wrong value types. Ensure correct values and lengths 127 2024-02-05 Reini Urban dxf spec: change DIMSTYLE.DIMTXTDIRECTION from 295 to 294 ODA has it documented as 295 B0, netDXF as 294. Acad has it undocumented. It has a default of 0, so only present if reversed. But accept indxf of 295 also (for ODA and backcompat) See GH #835 2024-02-05 Reini Urban debug: enable MTEXTATTRIBUTEOBJECTCONTEXTDATA.context as embedded SCALE object, if the SCALE is not 1:1. See GH #851 fix missing bindings/Makefile.in Fixes GH #934 log timeduration better Fixes GH #916 2024-02-04 Reini Urban up/downgrade MLINESTYLE_line.lt. fields Add a new dwg_find_tablehandle_index() helper, which is needed for more upgraders. Fixes GH #924 2024-02-04 Reini Urban spec: fix MLINESTYLE_line.lt_ fields to union because of the tricky overflow check in REPEAT_CHKCOUNT_LVAL. Fixes #924 WIP add_test. dxf from/to 2018 needs a converter. 2024-02-04 Reini Urban disable broken gcc-14 -Walloc-size Fixes GH #931 doc: mention ACadSharp fix -Wcalloc-transposed-args Fixes GH #931, thanks to @topazus 2024-02-04 Reini Urban Release 0.13 See NEWS. Read and write DWGs from r1.1 to r11 also 2024-02-03 Reini Urban encode: extra 2ndheader write See GH #860 2024-02-02 Reini Urban doc: one more ODA spec update more links doc: update ODA spec patches links spec: fix MESH 2 missing bits 2018/Surface take these 2 bits from the handles. Fixes the MESH ODA error 2024-02-01 Reini Urban spec: fix LEADER.endptproj for r13c3 fixes r13c3/from_autocad_r14/bflyhse.dwg ODA roundtrip errors 2024-02-01 Reini Urban encode: write 0 padding bits, not 1 eg. as seen in CARWHEEL_from_autocad_r13 with STYLE padding bits in the original it was 0, in the new 0x77, leading to an oda error in this style object, and different CRCs. Might be related to GH #346 2024-02-01 Reini Urban NEWS for 0.13 2024-01-31 Reini Urban comment: add more AEC objects found in some ACadSharp example encode: r2004 classes Forgot the 3 extra fields as in read_2004_section_classes(). 2024-01-30 Reini Urban dxfclasses: add missing MESH/AcDbSubDMesh class bump the copyrights to 2024 2024-01-30 Reini Urban injson: fix Dwg_VALUEPARAM subclass with a proper subclass name we can now almost import ASSOCACTION's. Missing: resolve of inlined Dwg_EvalVariant ERROR: Unknown subclass field VALUEPARAM_vars.code ERROR: Unknown subclass field VALUEPARAM_vars.u 2024-01-30 Reini Urban insjon: fix MESH.crease malloc array e.g. 2018/Surface. GH #830 encode: downconvert header.sections 2024-01-29 Reini Urban encode: fix sections patchup, fix header crc we wrote num_sections, not sections. the ODA crc calc. is also widely complicated, it is rather simple encode: skip the 2ndheader rewrite on size changes in real ACAD dwgs this 2ndheader template address is just zeroed. only in the header.section it is then correct 2ndheader: re-write 2ndheader when its size changed for the template address. also fix 2ndheader.num_sections (6 not 7) llvmfuzz_standalone_tz.sh: accept file arg bits: comment bit_TV_to_utf8 leak case Answering JoraGevorgyan, GH #926. See ossfuzz 66248 2024-01-29 Michal Josef Špaček Remove UNTIL (R_2000) Everything is UNTIL (R_2000), so we don't need. Fix encoding of second header logging address is address after sentinel, same in decoding address is address before sentinel size is second header block + begin sentinel Fix section numbers sections are sections in header and aux header num_sections are all sections 2024-01-27 Reini Urban doc: Update README for preR13 2024-01-27 Reini Urban encode: extend max num_classes to overflow into negative bits_test: print error hint fix json e.g. ./json example_2004 log: fixes for not existing args encode: print section names as with decode encode: missing template.address Need to move section_order into a global array encode: section_order adjust num_sections internally encode: maybe auxheader needs padding encode: maybe move auxheader before thumbnail decode: fix AVAIL_BITS, independent on obj->size AVAIL_BITS only depends on dat. fix the 2ndheader size check. 2024-01-27 Reini Urban encode: section_order harmonization use functions for each section, so that we can re-use 2004 code for 2000. and write sections in arbitrary order. 2000 as in 2004 2024-01-27 Reini Urban encode: add section_order[] and section_move funcs but not used yet 2024-01-24 Michal Josef Špaček Remove maximum of classes 2024-01-23 Reini Urban indxf: reject invalid number pairs 0\nSECTION ok, 0SECTION not ok. indxf: fix float-conversion overflow, fuzzing only with extremely large numbers. Fixes ossfuzz 65937 injson: ditto for RD* consume the token, and warn injson: fix RS* overflow, fuzzing only Fixes ossfuzz 66046 2024-01-18 Michal Josef Špaček Fix dictionary for R_13c3 There were typo in variable. 2024-01-11 Reini Urban shfmt: regen-shfmt without -kp shell: regen-shfmt shell: improve .DWG stripping 2024-01-07 washcloth Use python3 syntax and modernize shebang env Many systems do not provide the /usr/bin/python link. Instead use the env program to specify a python3 working environment. Presumably during a conversion to python3, a print statement during an error check was still in python2 syntax, this is now changed to proper python3 syntax. 2024-01-03 Michal Josef Špaček maint_versions to hexadecimal Fix presence of unknown variables 2024-01-02 Reini Urban spec: finish OSMODE BS 2024-01-01 Michal Josef Špaček Fix OSMODE variable in header it's BS not BL 2023-12-31 Reini Urban json.test: fix check_oda check_oda: r2000,r14 only 2023-12-31 Reini Urban add oda check to json.test indxf: fix double-free ossfuzz 64318 WIP 2023-12-31 Reini Urban spec: promote LAYOUTPRINTCONFIG to unstable we do have coverage, and it looks complete (just 6 padding bits) need convert_LTYPE_strings_area also for out_dxf, svg, json encode: add convert_LTYPE_strings_area for 256/512 byte conversions. See GH #910 in_dxf: fix LTYPE.strings_area for r2007+ Fixes GH #910 spec: fix LTYPE for r13-2004 for in_dxf wrong if-else brackets spec: change LAYOUTPRINTCONFIG to entity detected by OUT=3 examples/llvmfuzz_standalone ../test/test-data/2000/5.dxf is entity in dxf's (281: 1) and dwg's (item_class_id 498) Fix missing json dat->version Fixes GH #910 Fix dxfb_3dsolid heap-buffer-overflow with VALUE_BINARY (s, l) Fixes GH #911 2023-12-31 Reini Urban encode r11: protect from wrong tbl->number 2023-12-30 Reini Urban ninja ci: lukka/run-vcpk fails vcpkg.json.in is not found dxf: disable the VX table Import and output. It is not observed, not documented in DXF. Analog to DXFB 2023-12-27 Reini Urban *-check: fix dxf $r, esp. for r13 bits: extra bit_read_TF length overflow check ERROR: bit_read_TF buffer overflow at 2441.0 + -559041242 > 3806 2023-12-27 Reini Urban header.spec: move section field into spec so that it is tracked in json, to en-/disable a potential r13 second header. Fixes GH #860 2023-12-26 Reini Urban json: fix type confusion encode: fix downconvert_DIMSTYLE eed overflow need room for the final size=0, num_eed includes that. esp. when all the DIMSTYLE APPID's already exist. formatting only 2023-12-25 Reini Urban bits: fix fuzzing bit_H_to_dat overflow with invalid handle size encode: fix NULL deref in remove_EXEMPT_FROM_CAD_STANDARDS_APPID Fixes GH #901 OUT=0 VER=3 examples/llvmfuzz_standalone ../ti/gh901/other/testcase 2023-12-24 Reini Urban decode: fixup for 2ndheader wrong overflow check 10c79fd51df35afdc3e0272e58075e8d5d2e9a3c added obj, which fails with AVAIL_BITS. Thanks to Michal, GH #860 postprocess_SEQEND: improve Missing owner log the handle, search the owner on preR13, as in indxf 2023-12-23 Reini Urban in_dxf: fix uninit in \M+ scanning Fixes testcase 0 from GH #901, detected by Matteo Marini. decode: fix fuzzer error with Invalid auxheader_size testcase 1 of GH #901 2023-12-23 Reini Urban more dwg_next_handle fixes. Fixes GH #891. dwg->num_objects is unreliable fix dwg_next_handle For GH #891. Scan all objects backwards for the next handle, not the global refs. preR13 has almost no global refs alive.test: enable preR13 tests doc: patch updates decode: header pos asserts 2023-12-21 Reini Urban injson logging: no hex thumbnail_address 2023-12-18 Reini Urban decode_r2007: fix heap overflow by one Just a harmless 1 byte overflow with an invalid odd section->name_length. not security relevant. Fixes GH #899. Fuzzing only 2023-12-16 Reini Urban json: change AdDbAssocDimDependencyBody typo 2023-12-15 Michal Josef Špaček Remove zero_5 from header Remove zero_5 from second header 2023-12-15 Reini Urban regen-dynapi for BSd TREEDEPTH 2023-12-14 Michal Josef Špaček Simplify decoding of ObjFreeSpace section and second header These two sections are independent Fix TREEDEPTH header variable It is signed number 2023-12-07 Reini Urban fix 2ndheader logging null-deref Fixes fuzz GH #890 2023-12-05 Reini Urban json: dont cquote 3DSOLID.acis_data they are chunked by 256 max, not encoded, and without any to be escaped chars 2023-12-03 Reini Urban oda: fix shell warning oda: line 51: [: =: unary operator expected dwg2SVG: feature ordering not too late 2023-12-01 Michal Josef Špaček maint_version in aux header to hex format Fix R_2002 dwg_version Fix comments about AutoCAD releases 2023-11-30 Reini Urban make: run log-dwg and check-ossfuzz in parallel and esp. with spaces in filename support (find -print0 | xargs -0) logging: improve 2ndheader.dwg_version (hex) outdxf: protect against ACIS.block_size overflow terminate the encr_sat_data[i] block. Fixes ossfuzz 59124 indxf: fix some fuzzing leaks on errors ossfuzz 44697 fix more unused vars detected by msvc/clang-cl 2023-11-29 Reini Urban fix unused vars detected by msvc/clang-cl WIP fix 2ndheader Fixes GH #860. Write the correct 2ndheader.size, and address. write no objfreespace of none read (even if num_sections) patch the 2ndheader.size decode_r11: add dwg_next_handseed Fixes Duplicate handle errors with r11. Fixes GH #879 bits: fix RLL_BE reading and writing, down to RS_BE. Fixes the r11 HANDSEED and EED handles, Fixes GH #883 no abort() in libraries bits: fix bit_TV_to_utf8_codepage heap-buffer-overflow Fixes GH #881 bits: protect from more size overflows Fixes GH #880 2023-11-28 Reini Urban decode: zero-init objfreespace also 2023-11-28 Reini Urban emscripten/WASM support Closes GH #876 Compiles fine with: emconfigure ../configure --disable-bindings --disable-shared make -j -s but not tested in a browser (no stdio in the console via node programs dwg...) 2023-11-28 Reini Urban decode_r11: assign free handles for new objects See GH #879 And fail on existing duplicate object handles. unit-tests: add --all option, alias to -an spec: r11 signed VX_TABLE_RECORD RS fields WIP: encode r11 blocks all BLOCK into BLOCKS Interestingly seems to fix GH #879 2023-11-27 Reini Urban r11: harmonize POS logging oda: better fix for r11 fix CMC and H tracing on encode log the POS after the write, not before. analog to decode. json: simplify SUB_FIELD_T, VALUE_TEXT_TU, VALUE_TEXT All of them must convert to UTF-8 doc diff: add more specs api: fix GEODATA.north_dir to 2RD also fixes GEODATA imports api: fix GEODATA.north_dir to 2RD also fixes GEODATA imports auxheader: wrong maint_version casts Fixes GH #871 2023-11-27 Frank fix GEODATA num pts 2023-11-24 Reini Urban objfreespace: since r13 already Fixes GH #872 objfreespace: set objects_address only r13-r2000 r2004-r2007 has 0 encode: set objfreespace defaults Fixes GH #869 api: clearup dwg_add_SEQEND blkhdr confusion Fixes GH #856 spec: fix r13 DICTIONARYWDFLT Fixes GH #864 2023-11-23 Reini Urban encode: skip MATERIAL (and its NOD) and its common handle link. encode: keep thumbnail and template section order if we have the old addresses. else honor the old version logic. Fixes GH #853 2023-11-23 Reinhard Urban encode: fix r13c3 templates oda errors went from 213 to 172. master has 99 of 971 though. but fixed most r14 errors, only 3 vs 30 in master. json: add json_section_objfreespace 2023-11-23 Reini Urban Rename the MEASUREMENT section 4 to Template for consistency r13 objfreespace do decode (also with section[3].address == 0) add encode. 2023-11-23 Michal Josef Špaček r13-2000: Fix encoding of 2ndheader, add objfreespace In DWG file header is address and size for objfreespace section. The 2ndheader is after that section with extra sentinels, main data and crc. Improve logging of sections auxheader hasn't sentinel - fix comment 2ndheader have sentinels - fix comments 2023-11-23 Reini Urban spec: fix appinfo class_version 2/r2004 analog to SummaryInfo. e.g. test-old/2004/from_cadforum.cz/corvette.dwg HACKING: update commit prefixes 2023-11-23 Michal Josef Špaček Unify log of maint_version Same as in HEADER and Second Header 2023-11-21 Reini Urban encode: honor secondheader.num_sections on empty num_sections. injson: fail on arrays when a primitive expected e.g. ossfuzz 63057 doc: probe for HAVE_ODA_SPEC 2023-11-20 Reini Urban doc: diff.pdf - Variabele typo doc: diff.pdf - MTEXT, LEADER, FIELD add doc/ODA-5.4.2-libredwg-diff.pdf a colored diff as pdf decode: cleanup dead code add doc/ODA-5.4.2-libredwg.patch as generated privately 2023-11-14 Reini Urban json-check: keep old err to see regressions and improvements 2023-11-13 Reini Urban decode_r11: fix dat->byte wraparound heap-buffer-overflow Fixes ossfuzz 64118 2023-11-10 Reini Urban spec: fixed PROXY.data size hack fixes overflow with ossfuzz 63814 decode: missed a dat restore on an decode error (MS size overflow) decode: improve bit_read_fixed buffer-overflow on wrap-around. 2023-11-09 Michal Josef Špaček Fix layer.on decoding 2023-11-09 Reini Urban add timeout to llvmfuzz_standalone_*.sh some tests hang 2023-11-08 Reini Urban encode: fix NULL-deref with old files (r1.1) Fixes ossfuzz 63895 free: fix DWGCODEPAGE indxf leak Releated to ossfuzz 63895 indxf: fix stack-buffer-overflow Fixes ossfuzz 63919 encode: fix r2004 section dat leaks with no info pages 2023-11-06 Reini Urban encode: fix 2ndheader hdl overwrite fixed size patchup encode: fix r1.4/entities roundtrip for BLOCK/ENDBLK need to keep BLOCK/ENDBLK in entities, no blocks section. suppress -Wcast-align warnings we already know about them already, and there's a branch to fix it. encode: revert -Wstringop-overflow suppression the error was a MIN/MAX confusion, not a compiler bug. 2ndheader: add VALUEOUTOFBOUNDS checks because example_r14 overflows num_hdl still encode: set 2ndheader.handles[].name for better logging encode: forgot 2ndheader.junk_r14 json also. injson: fix RS[] type confusion check that the parsed type (ie. HEADER.layer_colors) fits the real type sizes. Fixes ossfuzz 63824, a stack overflow 2023-11-03 Michal Josef Špaček junk_r14 is from r14 to r2000 Fix CRC Fix second header structure 2023-11-03 Reini Urban encode: add LOG_TFv same problem as with write_TFv on downgrading encode: more downgrading support add dwg_supports_eed and dwg_supports_obj. skip writing unsupported entities and objects pre-R13. >= r13 we keep our old logic for handles refs. json: dont skip *MODEL_SPACE BLOCK_HEADER only with encode later llvmfuzz_standalone: dont print unnecessary SEED when we dont need rand(), when all env vars already given 2023-11-02 Reini Urban encode: even more encode_check_num_sections checks indxf: fail on setting a num_ values twice Fixes GH #859 encode: more encode_check_num_sections checks free: fix HYPERLINKBASE double-free add bit_wcs2dup cmake: sort probes add HAVE_GETTIMEOFDAY probe more llvmfuzz_standalone_*.sh rename llvmfuzz_standalone_all.sh to llvmfuzz_standalone_tz.sh add llvmfuzz_standalone_data.sh fix env vars to check all permutations. skip leaks only on indxf encode abstract into encode_check_num_sections needed also for encode: fix new r11 sections on upgrade llvmfuzz: honor config.h encode: some unused variables llvmfuzz: better seed precision (millisecs) llvmfuzz_standalone: improve repro output header_variables_dxf.spec: fix summaryinfo types encode: add new r11 sections on upgrade encode: no 2ndheader sections overflow on downgrade spec: index 6 out of bounds for type Dwg_SecondHeader_Sections[6] with encode (fuzzing) encode,json: downgrade TV strings to TFv which might be shorter than the TF, so skip the slack. 2023-10-31 Reini Urban add llvmfuzz_standalone_all.sh and test most versions llvmfuzz: support env SEED bits: fix CHK_OVERFLOW CHK_OVERFLOW_PLUS is ok. Fixes ossfuzz 55579, 54163, 54162, 57911, 60993 2023-10-31 Reini Urban spec: change 2ndheader handles[].hdl to static Boy, do I hate these gcc -Wstringop-* bugs! Still not fixed in 11.4 after 4 releases. Fixes ossfuzz 61796 in free() in encode 2023-10-31 Reini Urban fuzz: limit max. alloc size to 0x10000000000 taken from asan: AddressSanitizer: requested allocation size 0xffffffff00cee7ad (0xffffffff00cef7b0 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 fixes some fuzzing DOS attacks. also optimize bit_write_TF when needing more room. and fix it when aligned. 2023-10-31 Reini Urban encode r11: forgot writing eed raw size Fixes ./rw r11/ACEB10 2023-10-30 Reini Urban decode_r11: fixup Invalid obj->size change 2023-10-30 Reini Urban decode_r11: more wrong obj->size checks Fixes more preR13 fuzzing tests $ examples/llvmfuzz_standalone ../tz/*/clusterfuzz-testcase-* but breaks ./rw r11/ACEB10 2023-10-30 Reini Urban dxf2dwg: honor --force-free also with errors to repro ../tz/indwg/clusterfuzz-testcase-minimized-llvmfuzz-5075763015057408.dxf llvmfuzz_standalone: srand the env vars and print them bit_TV_to_utf8: fix illegal write on failed iconv conversions with too short destlen. Fixes ossfuzz 63629 dwgfuzz: fix some NULL derefs e.g. clusterfuzz-testcase-minimized-llvmfuzz-4602743341580288 Fixes ossfuzz 63690 injson: fix pre-R2 layer_colors setter stack-overflow even. decode_r11: fix heap-overflow by 1 Fixes ossfuzz 63483 indxf: fix dxfname double-free analog to dxf_entities_read. Fixes ossfuzz 65537 dynapi: fix fixed_string termination Fixes ossfuzz 59523 dynapi: fix r11 MENU size Fixes ossfuzz 50194 regression json: protect NULL derefs Fixes ossfuzz 47352 indxf: fix spline fitpts check Fixes ossfuzz 44697 indxf: fix heap overflow, wrong type Fixes ossfuzz 44483 fuzz: avoid double fclose on IO errors Fixes ossfuzz 39933 injson: no exit in a library Fixes ossfuzz 37355 indxf ditto: fixes ossfuzz 46916 dwg_api.h: check for __attribute_deprecated__ e.g. already defined with compcert .clang-format: fix syntax error 2023-10-29 Reini Urban regen-dynapi: formatting decode_r13: ignore invalid obj->size Fixes ossfuzz 63463 heap-overflow free: fix preR13 unknown_rest leaks geojson: check out of memory With invalid ARC angles. Fixes ossfuzz 63690 llvmfuzz: fix missing initializers 2023-10-27 Reini Urban json-check: use $ODAFileConverter_geometry env 2023-10-26 Reini Urban json-check: revert geometry again (wayland vs X) indent: proper VERSION blocks 2023-10-25 Reini Urban cmake: require C99 standard and define HAVE_C11 via __STDC_VERSION__ set PRI_SIZE_T_MODIFIER on cross check HAVE_C11, but don't use it, because mingw ignores it. rather set PRI_SIZE_T_MODIFIER manually then (based on mingw32, mingw64, ppc64, mips32, aarch64) fix and run clang-format-all support new -Wanalyzer warnings add AX_PRINTF_SIZE_T %zu formatting Fixes GH #857 2023-10-23 Reini Urban encode: silence unknown_rest if unneeded encode: on dwg_encode_unknown_bits skip the rest injson: fix Unknown type for REGION.revision_bytes RC with STRING dynapi doesn't know of this array type (yet). 2023-10-21 Reini Urban encode: revise preview_size check for encode, where we dont have the obj->size. eg. example_2018 2023-10-21 Reini Urban decode: improve Invalid preview_size error with to/r13/from_autocad_r13/ROBOT.DWG. check against the obj->size not some hardcoded too low limit. But now this file fail with out of memory on outjson 2023-10-20 Reini Urban Revert "json-check: geometry at lower-left corner" This reverts commit 09c73ba18d4c4f2f8b29b252c7648191b182375b. This does not work on Fedora (wayland). add unknown_rest to replace some unknown_bits oda errors went down from 174 to 168 of 969 WIP attdef debug json: we emit non-empty unknown_bits so remove JSON DECODE_UNKNOWN_BITS. GH #855 convert JUMP.trailing also to unknown_bits preR13 store ERROR: offset slack in unknown_bits Fixes GH #855 json-check: fixup source dwg as first line json-check: geometry at lower-left corner json-check: source dwg as first line in .err for easier regression checks 2023-10-19 Reini Urban indxf: fix dxfname double-free Fixes ossfuzz 57481 2023-10-17 Reini Urban injson: fix R2004_Header.file_ID_string not hex 2023-10-13 Reini Urban spec: rename ATTRIB,ATTDEF.mtext_handles to mtext_style and add missing attrib unit-test field checks. those r2018 mtext fields are still unstable. 2023-10-12 Reini Urban encode: disable downconvert_relative_handle Of course r2000 can read relative handles just fine. They are mandatory for prev,next_entity links. Just first,last_ links and similar 4 links were always absolute. Just VX_TABLE_RECORD.ownerhandle is relative. But this must be defined in the caller, if obj or NULL. 2023-10-11 Reini Urban json-check: better cleanup on success dwg_sentinel: remove superfluous bounds-check 2023-10-10 Reini Urban encode: refactor r13-r2000, thumbnail, meas, objects CRC esp. write objects crc. Fixes all ODA CRC errors with all r2000 test files. TODO: we could also check if the old r2000 dwg has the template/image before or after. ODA is not quite right Fixes GH #853 2023-10-10 Reini Urban decode: comments only json-check: change .log.orig, improve diff ignore the indices. no double initial logs, just the outjson log. fix invalid ACAD11 r, wrong checks. 2023-10-09 Reini Urban encode: fixup header.thumbnail_address wrong pos. also keep an existing r14 auxheader. encode: fix Handles page CRC as BE fixes WRONGCRC errors with overlarge Handles page sizes encode: patchup header.thumbnail_address which may move the thumbnail upfront. Fixes GH #853 encode: no TV-ZERO with r13c3 2023-10-06 Reini Urban decode: more work on dwg_section_page_checksum but still wrong (for writing r2004) decode: add dwg_section_page_checksum overflow check spec: hack FIELD a bit to fix 2018/TS1 json-roundtrips. need the logic when to omit TABLE_value.value_string 2023-10-05 Reini Urban decode_r2007: fix fuzzing out-of-bounds reset invalid section->num_pages. Fixes GH #850 refactor injson dynapi for inline arrays maybe the reason for the GH #851 readDWG crash. simplifies a lot. 2023-10-03 Reini Urban bits: %u dat->bit warnings on mingw32 cmake: use -Wno-error=array-bounds 2023-10-03 Michal Josef Špaček Fix comment about layer_colors in header file Add r1.1 and r1.2 versions for dwgadd It's working Remove obsolete warning for pre r1.4 All versions like r1.1 and r1.2 are working. There are not evidence for AC1.30 DWG files 2023-10-02 Reini Urban bits: more iconv fuzzing fixes check now also errno and the full dest range. Fixes again ossfuzz 62363 2023-09-30 Reini Urban fuzz: fix decode_preR13_section overflow with negative tbl->number. Fixes GH #848, maybe. 2023-09-24 Reini Urban decode: add dxf logging to VECTORs 2023-09-23 Reini Urban injson: add_handle for all object handles to fill the object_map{}, to properly resolve 0 handles later. See GH #830 2023-09-23 WU LONGYONG fix: the number of dividing angle if want to cut an angle to 10 points the delta angle should be divided as 10-1=9 2023-09-22 Reini Urban fix dwg_resolve_handle when the handle wasn't found. Too eager bounds check. See GH #830 2023-09-22 Reini Urban injson: fix sort_ents add_handleref this is an exception for code 0. No obj, see GH #830 WIP: Warn Wrong ref_object ref->obj->handle.value != ref->absolute_ref with 2018/Surface with 0.2.2CF enable-check-less: also for programs, examples ubsan needs 44m on github. make check from 9m to 14m (even with check_less) 2023-09-21 Reini Urban configure: default to -fhardened compiler flags 2023-09-21 chunibyo fix angle normalization loop and a segment fault bug. 2023-09-21 Gian Maria Gentilini <38076337+gentilinigian@users.noreply.github.com> spec: Add LEADER.hookline_on flag calculation Re-calculate AutoCAD's hookline display rules, different to ODA. (but more likely more correct) Rewritten by Reini Urban. Insignificant contribution. 2023-09-19 Reini Urban spec: add RLLd type (signed int64) though unused yet. Dwg_R2007_Section will need that. The AcDS sortedidx is not, I think json: more bit_TV_to_utf8 iconv protections check heap overflows with iconv dest result bits: memcpy-param-overlap Fixes oss-fuzz 62461, though not repro 2023-09-12 Reini Urban indxf: fix double-free with INVALIDDWG cases when the dxfname was allocated and the import error occured later. Fixes oss-fuzz 59428 bits: fix double-free in Out of memory error Fixes oss-fuzz 48236 crash 2023-09-11 Reini Urban encode: dont encode from invalid version and dont realloc a nullptr. Fixes oss-fuzz 62132 decode: fix unsigned overflow asan: allocation-size-too-big Fixes oss-fuzz 59899 2023-09-06 Reini Urban bit_read_TV: optimize TV-ZERO logging a bit decode: log xdata.type RS with -v4 not just insane. I forgot where the xdata_size came from. the RS type 2023-09-04 Reini Urban decode_r11: fix wrong ltype size for POLYLINE/VERTEX Fixes GH #832 2023-09-01 Reini Urban rename R_2022 to R_2022b this beta-only format was not used in regular releases until r2024 encode: in_postprocess_SEQEND with one entity there is no nolinks (single vertex). TODO: the same for the BLOCK entity chain 2023-09-01 Reini Urban encode: fix in_postprocess_SEQEND from injson where we have no target version. fix the nolinks setter. log the vertex index. Fixes GH #829 for POLYLINE, BLOCK not yet 2023-09-01 Reini Urban configure: rename --enable-mimalloc to --with-mimalloc it's an optional library, not a feature. 2023-08-31 Reini Urban injson: support 3BD* points Fixes e.g. 3DSOLID_wire.points. Detected via GH #827 json: skip duplicate COMMON_3DSOLID See GH #827 2023-08-31 Reini Urban spec: improve WIRESTRUCT_fields mostly the 2 BLd fields to appear as -1. and to skip num_points with json. See GH #827 2023-08-31 Reini Urban bmp: fix wrong r2007 overflow errors general logical error, but only appearing with r2007 thumbnails. Fixes GH #824 2023-08-31 Michal Josef Špaček Fix presence of AuxHeader I has no evidence, that AuxHeader is in any DWG files like AC1013 and AC1014. Fix MEASUREMENT value The possible values for the MEASUREMENT field are: 0 - English 1 - Metric 2023-08-31 Reini Urban dwgbmp: extend to emit WMF and PNG See GH #824 dwgwrite: new version defaults, don't write r2000, but old versions asis readers would perfer r2000 or higher, oda can only read from r9 on, but for the sake of sanity don't upconvert preR13 to r2000 per default. only =r2004 down to r2000. This way we have much less up/downconverting changes. 2023-08-30 Reini Urban update NEWS promote RENDERENVIRONMENT to stable dxf and coverage ok spec: fix RENDERENVIRONMENT.fog_color the last text environ_image_filename is still unknown spec: rename ObjFreeSpace num fields no num_ prefix, to let them appear in json. they are not vector sizes. 2023-08-29 Reini Urban indxf: fix SUMMARY strings no use-after-free, convert from codepage to TV fixes ./dxf example_201*.dwg injson: handle 3DSOLID.revision_bytes[9] TFFx encode: more downconvert_TABLESTYLE because some border colors were invalid. fill in sensible defaults *-check: stabilize .log.orig creation because some b's are other than other b's json: im-/export the R2007_Header analog to R2004. json: skip r2004fileheader with r2007 it is empty there 2023-08-29 Reini Urban json: fix xdicobjhandle logic write now the xdicobjhandle if not missing. Fixes oda errors Invalid input AcDbBlockTableRecord(1F), and Object of class AcDbRegAppTableRecord cant be cast to AcDbEntity See GH #322 2023-08-29 Reini Urban encode: abstract delete_hv and fix another memmove error, the ptr size! and also fix a shift_hv leak encode: fixup remove_EXEMPT_FROM_CAD_STANDARDS_APPID memmove too many entries! 2023-08-29 Robert Scott dwg2SVG: define _GNU_SOURCE to expose strcasestr with musl libc 2023-08-28 Jarkko Hautakorpi decode r11: error: ‘__builtin_strncat’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] header_variables_r11.spec:164:20: note: length computed here 164 | size_t len = strlen ((char*)&_obj->MENUEXT[1]); 2023-08-28 Reini Urban add examples/odaversion helper encode: fixup FREED objects they did appear twice, so skip them in the HANDLES omap list already logging: RLx on eed 71, when overlarge i.e. rgb colors encode: skip also UNUSED objects and print the name and handle 2ndheader: wrong crc type only detected by clang Fixes GH #820 2023-08-27 Reini Urban encode: skip freed object namely the APPID.EXEMPT_FROM_CAD_STANDARDS fix gcc14 -Wanalyzer-null-argument with is_class_unstable (dwg_type_name (type)) gcc14: silence more wrong -Wanalyzer bugs gcc14: silence wrong -Wanalyzer-allocation-size in ADD_ENTITY ALIGNMENTPARAMETERENTITY indxf: fix -Wanalyzer-possible-null-argument null dxfname, CWE-690, with gcc 14 encode: avoid uninitialized dat->chain"s leading to false gcc 14 -Wanalyzer-malloc-leak errors in bit_chain_init 2023-08-26 Reini Urban encode: remove APPID.EXEMPT_FROM_CAD_STANDARDS GH #817 reedsolomon: document matrix ranges gcc-14 warns reedsolomon.c:307:54: error: dereference of possibly-NULL '*_20 + _22 + (sizetype)i' [CWE-690] [-Werror=analyzer-possible-null-dereference] 307 | ^= f256_multiply (coeff, matrix[src][j][i]); fix CWE-401 -Wanalyzer-malloc-leak detected with latest gcc add config --with-{geojson,dxf}-precision And switch the default back from the RFC recommended 6 to max 16. See GH #810 Revert "encode: remove APPID.EXEMPT_FROM_CAD_STANDARDS" Flaky, and we need to add removal of this handle from individual EED's also This reverts commit 3247beebd2efd84241a8406536fc89870fc676dc. 2023-08-25 Reini Urban encode: remove APPID.EXEMPT_FROM_CAD_STANDARDS GH #817 add oda tool with json or dwg input regen-dynapi: summaryinfo T16 2023-08-24 Reini Urban encode: fix OLE2FRAME wrong MAX_SIZE_TF they can be much larger. Fixes json-check 2000/TS1 encode: r2004_file_header.file_ID_string encode: fix r2004 assertions json-check: delete the old errors because without new errors this would stay dwg2ps: handle T16 summaryinfo types Fixes GH #812 Also add Subject Info 2023-08-24 Michal Josef Špaček Fix error handling in dwg_encode() Fix number of sections in encoding of header (preR13) 2023-08-23 Reini Urban add: default TDCREATE via TDUCREATE. WIP not sure how to create these julian days since 1970 encode: on downconvert add the missing VX_CONTROL object Fixes GH #811 encode: always write SecondHeader now for r13b1-r2000. Maybe that's what's causing the oda recovery warnings spec: fix summaryinfo <2007 T16 is not always TU this fixes esp. decode errors. 2023-08-22 Reini Urban c99: regen codepages, fix -Wc99-designator array designators are a C99 extension, and illegal with C++ c++compat fixes gh: mips decode.lo needs more than 25m logging: less -v3 decode tracing no crc address ranges. no EED raw TF content 2023-08-21 Reini Urban escape: honor codepage in htmlescape() add asian codepage support escape: workaround gcc-12 uaf var-tracking bug See GH #801 2023-08-18 Michal Josef Špaček Fix creating of line entity in preR13 3DLINE entity isn't in R11 In R10 is possibility of 3DLINE or LINE (with 3d support). Rewrite to use of LINE. Fix thumbnail on the end of data 2023-08-18 Reini Urban unit-tests: silence ERROR: dwg_ref_get_object: empty ref rather resolve them decode_2007: refactor to Bit_Chain the page and section maps. now they are proper fields. See GH #806 2023-08-17 Reini Urban preR13: set HEADER.LTYPE_CONTINUOUS ref See GH #761 logging: 2ndheader handles Fixes GH #804 bits: simplify bit_write_H via bit_H_to_dat Releated to GH #804 encode: fix 2ndheader copypasta VX_CONTROL_OBJECT for 10th handle. Fixes GH #803 ubsan: stricter alignment checks when even alloced pointers are not memaligned. (as with ubsan or other weird archs) logging: only insane T if there is a high char 2023-08-16 Reini Urban logging: LOG_INSANE_T on unusual codepages See GH #802 bits: fix strlen(NULL) Fixes ossfuzz 61497, 61494 msvc: fix declspec position also clang-cl encode: fixup section[4] fields before writing the MEASUREMENT_R13 section. Fixes GH #792 bits: fix ubsan alignment checks Fixes ossfuzz 59124 2023-08-15 Reini Urban logging: fix null-deref with empty dwg_find_tablehandle results bits: fix bit_u_expand and add tests Fixes GH #802 bits: add MIF support to bit_u_expand Tests missing 2023-08-15 Reini Urban bits: bit_TV_to_utf8 handle asian codepages non-asian <0x80 exceptions not-yet. add LOG_TRACE_TV with utf-8 conversion See GH #802 2023-08-14 Reini Urban codepages: remove CP_SHIFTJIS it is CP932 now codepages: add CP932 (alias for shiftjis) also add missing the c < 128 exceptions for a few asian codepages. and fix the MIN_*_UC unused defines. codepages: fix dwg_codepage_isasian and document the asian multi-byte specialities. Closes GH #802 2023-08-13 Reini Urban svg: fix and simplify htmlescape no realloc use-after-free Fixes GH #801 dxf: convert all MIF \M+1-5 DXF encodings to \U+xxxx as documented by ODA, not in any DXF nor FrameMaker documentation. Fixes GH #428 2023-08-11 Reini Urban json: fix print_wcquote to print utf-8 not \uxxxx chars, when possible. Fixes GH #655 dynapi: special-case HEADER.codepage for dwgadd. Fixes GH #727 examples: add wine/valgrind support to dwgadd_test.sh logging: compacter FIELD_VECTOR tracing on decode 2023-08-11 Reini Urban change 2ndheader: handles and sizes always set handles, rename them. identified the source for all 2ndheader.handle fields, the HANDSEED and CONTROL_OBJECT parts from the header_vars, so we can always set them reliably. fix sample_2000 with unknown_10 == 0x14 => unknown_rc4[3] 2023-08-09 Reini Urban spec: ARRAYITEMLOCATOR.itemloc[3] inlined array use SUB_FIELD_VECTOR_INL node[4] is now also an inlined json array. add 2ndheader.spec and rename second_header to secondheader Fixes GH #800 decode: better vcount logging strip the vcount (e.g. entries[]), and add LOG_RPOS throughout spec: move ASSOCGEOMDEPENDENCY, ASSOCNETWORK to stable can be ex-/imported via json and dxf unit-testing: improve failing assoc2dconstraintgroup check max num_connections and empty connections 2023-08-08 Reini Urban actions: --disable-werror on macOS CI which throws -Werror=cast-align, by not honoring $ax_cv_check_cflags__Wcast_align = yes 2023-08-07 Reini Urban 2ndheader: rename handlers.size to num_data spec: harmonize SUB_FIELD_VECTOR API type before size 2ndheader: fix unknown_rc4 reset hack no dat->byte -= 2, check unknown_10 for subsequent length 2 or 4 just for json stay with length 4 for now, as in_json _INL cannot decide on 2/4 yet. decode: better 2ndheader logging spezialize the section and handlers repeats 2023-08-04 Reini Urban decode: enhance APPINFO.max_decomp_size as seen in GH #797 2023-08-04 Michal Josef Špaček Improve logging of addresses 2023-08-03 Michal Josef Špaček Improve logging output for unknown_rc4 in second header Main intent is removing of [i], not intuitive Before: unknown_rc4[i]: 0x78 [RC 0] unknown_rc4[i]: 0x1 [RC 0] unknown_rc4[i]: 0x5 [RC 0] unknown_rc4[i]: 0x0 [RC 0] After: unknown_rc4[0]: 0x78 [RC 0] unknown_rc4[1]: 0x1 [RC 0] unknown_rc4[2]: 0x5 [RC 0] unknown_rc4[3]: 0x0 [RC 0] 2023-08-03 Michal Josef Špaček Improve logging output for second header null_b[] Improve logging output Main intent is removing of [i], not intuitive Before: null_b[i]: 0 [B 0] null_b[i]: 0 [B 0] null_b[i]: 0 [B 0] null_b[i]: 0 [B 0] After: null_b[0]: 0 [B 0] null_b[1]: 0 [B 0] null_b[2]: 0 [B 0] null_b[3]: 0 [B 0] 2023-08-03 Michal Josef Špaček Fix indentation of clang-format off comment Fix dxf in FIELD_VECTOR_INL logging 2023-08-03 Michal Josef Špaček Improve logging output for zero_5 header variable Main intent is removing of [i], not intuitive Before: zero_5[i]: 0x0 [RC 0] zero_5[i]: 0x0 [RC 0] zero_5[i]: 0x0 [RC 0] zero_5[i]: 0x0 [RC 0] zero_5[i]: 0x0 [RC 0] After: zero_5[0]: 0x0 [RC] zero_5[1]: 0x0 [RC] zero_5[2]: 0x0 [RC] zero_5[3]: 0x0 [RC] zero_5[4]: 0x0 [RC] 2023-08-03 Reini Urban bits: fix bit_TV_to_utf8 and bit_u_expand fix the json_cquote leak with codepages. bit_TV_to_utf8 via iconv requires at least a destlen + 1 for the final \0. optimize empty strings. bit_u_expand needs to check for not-found substrings. json: set dat->codepage for json utf8 conversion. Fixes GH #788 bit_write_T16 converts from/to TU16 For GH #788 indent 2023-08-03 Michal Josef Špaček Fix logging There was a trailing newline 2023-08-03 Reini Urban update NEWS bump copyright's add a vcpkg.json cmake: fix deprecation warnings tested with 3.27.1 2023-08-03 Reini Urban -Wcast-align fixes need ATTRIBUTE_ALIGNED() but we would really need to alias all BITCODE_T as BITCODE_TU and then downcast for TV, to ensure the 2 alignment. 2023-08-03 Reini Urban enable more warnings, -Wmissing-field-initializers and fix a few others logging: log resolve_objectref_vector with HANDLE too much roundtrip noise 2023-08-02 Reini Urban json: fix json_write_TF \r and \n quoting injson: support SecondHeader section GH #792 json: write SecondHeader section GH #792 Not really sure if useful enough bit_utf8_to_TV: skip invalid UTF-8 characters helps with fuzzing. e.g. ossfuzz 57481 2023-08-01 Reini Urban template: use TU16 cast Fixes GH #788 2023-07-31 Michal Josef Špaček Move address and offset to LOG_HANDLE This is better to diff between dwgread log outputs 2023-07-31 Reini Urban encode: fix PROXY numbits calc. e.g. json-check example_r13 CMC: set method only in upconvert when undefined Fixes GH #785 CMC: method c2 (entity) defaults to 0xffffff rgb See GH #785 CMTC: also keep from_version >= 2004 Should fix GH #785, upconvert should be skipped also bits_test: add BS 1 test as XRECORD.cloning is written wrongly 2023-07-31 Michal Josef Špaček Implement template description write support Only for AC1013 .. AC1018 Rewrite decoding of template to use existing template_private() 2023-07-31 Reini Urban indxf: not too small Fixes GH #786 2023-07-28 Reini Urban add arc_split, angle_vector_2d: split arcs into lines for geojson arc and circle so far. TODO pline bulges Fixes GH #520 Arc's must be closed, which is weird, but demanded by the spec as closed Polygon. 2023-07-27 Reini Urban dxf: exit Convert SAB ACIS on len=0 at the end of the SAB. ./dxf example_2013 bigendian: workaround add_LibreDWG_APPID error in dwg_dynapi_entity_value in dwg_find_tablehandle bigendian: fix bit_read_TU wrong byteswap and wrong tests fix r11 HANDSEED RLLs, analog to EED decode_r2007 bigendian sections 2023-07-26 Reini Urban bigendian: improve bit_read_DD bigendian: fix bit_read_TU16 and bit_read_T32 bits: fix bigendian TU tests and optimize bit_write_T a bit. we already have the length. 2023-07-25 Reini Urban bigendian: various fixes and more bits tests add more RD and BD tests, esp. for the new optimized branches rename _LE to _BE variants, which are really big-endian. Wrongly named and unneeded. 2023-07-25 Reini Urban fix EED entity RLL: wrong conversion on aligned bit=0 also remove unneeded bits _LE variants (which are BE anyway) 2023-07-25 Reini Urban build: conditional AC_CONFIG_FILES on --disable-bindings and not HAVE_PYTHON_LIBXML2. Which should simplify make dist and docker builds without bindings. with --disable-bindings the dist would exclude that now. without makeinfo even the docs. 2023-07-25 Reini Urban add a Dockerfile.ppc64 with the current sources, for bits testing auxheader: change TDCREATE to TIMERLL from TD bigendian: fix bit_u_expand() iconv: fails at run-time on powerpc64-linux-gnu and now also on macOS with utf-8 constants 2023-07-24 Reini Urban iconv: use UTF-8//TRANSLIT//IGNORE as tocode but it still fails with 22 on powerpc64 modernize iconv.m4 probes dwgread: fix getopt_long usage with -o. Fixes GH #784 fixup common_test linkage 2023-07-24 Michal Josef Špaček Add tests for dwg_find_color_index() 2023-07-23 Michal Josef Špaček Fix LTYPE.strings_area conversion from JSON to DWG 2023-07-22 Michal Josef Špaček Add tests for bit_read_CMC 2023-07-21 Michal Josef Špaček Fix find of RGB color index 2023-07-21 Reini Urban bigendian: fix dwg_set_handle_size make check-minimal deps add in_hexbin_tests and add error checks to the non-release version 2023-07-20 Michal Josef Špaček Use in_hex2bin() in bits.c Move in_hex2bin() to bits.c This function is used in in_dxf.c and in_json.c 2023-07-20 Reini Urban spec: resolve plotview only from non-empty name also more logging. log example_2004 BE crash in json encode: add APPID LibreDWG add check-minimal target e.g. for ppc64 via qemu to keep CI timeouts at about 20m 2023-07-20 Reini Urban big-endian: run-time checks and most fixes I actually can check big-endian now, on ubuntu mips and ppc64 cross. But no debugging yet. And tests don't run through yet. Fix the Rx and Rx_LE variants for big-endian. Fixes GH #774 2023-07-19 Reini Urban configure: add AM_TESTS_ENVIRONMENT support for qemu cross-builds debian-style with qemu binfmt support. redhat sys-root style rpm's are broken by redhat, and would need manual labor. (even if they do sound better in theory) 2023-07-18 Reini Urban logging: change FORMAT_RD from %f to %g be less verbose unit-tests: fix RSd used table field 2023-07-17 Reini Urban add mips Dockerfile to actually test big-endian: many failures bigendian: broken since 0.12.5 as reported by suse obs, which does have a proper big-endian gcc, unlike fedora (missing sys-root). debian/ubuntu also have a proper powerpc64-linux-gnu cross target. add 64-bit (ppc) and 32-bit (mips) big-endian CI compilation targets. (without check so far) 2023-07-15 Reini Urban iconv: honor mingw WINICONV_CONST else fails on some mingw systems xdata: fix XDATA handle representation the 8 byte are only the handle value. 2023-07-13 Reini Urban dxfb: sync dxfb-check with dxf-check almost done outdxfb: handles confirmed as hex strings as with ascii dxf outdxfb: <=r12 requires leading 0xff for eed group codes afl: last AFL++ compilation fixes can now build all programs and examples, with --disable-werror. 2023-07-12 Reini Urban afl: fix AFL++ encode compilation obj is accessed now via downconvert_relative_handle() 2023-07-11 Reini Urban encode: define MAX_SIZE checks for fixed strings and vectors. we had these numbers before. Fixes ossfuzz #58143 2023-07-11 Reini Urban examples: missing bits dependencies bits: one more bit_TV_to_utf8 leak on error but not yet ossfuzz #58132 finished 2023-07-10 Reini Urban bit_TV_to_utf8: overlarge destlen fixes ossfuzz #58008 fuzz: honor dwg_sections_init errors also encode_r11_auxheader. Fixes ossfuzz #58019 2023-07-08 Reini Urban c++compat don't include limits.h from spec.h as it mixes up decls. 2023-07-07 Reini Urban clang-format: run build-aux/clang-format-all.sh src include test/unit-testing/ test/xmlsuite/ clang-format: prepare add more statement macros skip src/codepages/*.h (read-only) shellcheck: {json,dxf}-check 2023-07-06 Reini Urban decode: allow empty section_map_address Fixes GH #769 2023-06-29 Reini Urban decode_r11: clear on realloc ctrl entries Fixes ossfuzz 59428, double-free 2023-06-28 Reini Urban unit-tests: missing and wrong SWEEPOPTIONS_fields debugging only free: fix UAF with debug_classes dxf: default empty revision_guid 2 ODA throws invalid input there extend dxf-check roundtrips also check the generated DXF with oda 2023-06-27 Reini Urban decode: improve dwg_section_page_checksum now exactly as described in ODA, but still wrong decode: disable dwg_section_page_checksum warning status no DWG_ERR_WRONGCRC, as the calculation is still wrong decode: unify CRC mismatch log messages json-check: echo the correct ODA exec, add timeout for 2 r10 files 2023-06-27 Reini Urban encode: "was overlarge size" fixups size and bitsize stay the same, just move the content. test with ../json-check -v5 2007/colorwh Fixes 17 ODA errors 'CRC does not match' and .dwg needs recovery. 22 left 2023-06-27 Reini Urban bit_copy_chain: better docs ACTION_3DSOLID: fix double-free do not flush the hdlstream 2x. Fixes GH #497 bit_copy_chain: skip equal chains GH #497 encode: fix obj_flush_hdlstream honor unaligned rhs dat chains. though handles should be always aligned. 2023-06-26 Reini Urban restore c++-compat and some unused vars 2023-06-25 Reini Urban encode: downconvert_relative_handle only with non-class objects decode: fix wrong ERROR obj_string_stream overflow without strings, such as eg with IMAGEDEF_REACTOR in 2007/Leader 2023-06-24 Reini Urban windows compiler warnings unused vars in_json: fix LTYPE.strings_area type from TF to BINARY (hex). encode: fix bit_downconvert_CMC for non-truecolor color index prefer newer ODA over old TeighaFileConverter encode: downconvert_relative_handle r2000 cannot read relative handles 2023-06-23 Reini Urban json-check: support r11 files encode: fix downconvert_DIMSTYLE by adding a dwg_has_eed_appid() check. Now it roundtrips via ODA encode: add experimental downconvert_DIMSTYLE only EED for DIMSTYLE.Annotative encode: format Dwg_Section_Type stream_order encode: add downconvert_MLEADERSTYLE 2023-06-22 Reini Urban format: fix DISABLE_NODSTYLE to StatementMacros dwg_next_entity: fix fuzzing error when the next_entity handle points to an object, not entity. Fixes ossfuzz #60008 2023-06-21 Reini Urban spec: demote MLEADERSTYLE back to unstable no json roundtrips yet. ODA throws Object improperly read: (E5) with most 2010+ examples. 2023-06-20 Reini Urban spec: fix MLEADERSTYLE round-trips set class_version. but still fails with ODA 2023-06-20 Reini Urban spec: fix MULTILEADER for r14 we had a slack of 19 bits, which are exactly the r2000 bits missing (arrowheads, blocklabels, ...) r14/Leader roundtrips now ok with oda via json fixes Object improperly read: (640) with example_r14 2023-06-20 Reini Urban spec: fix entity_common vs entity field clashes esp. for the importers. We did set the wrong fields encode: support downconvert_TABLESTYLE to produce correct TABLESTYLE objects from versions >= r2007 since free follows the from_version, we need to specialize free_TABLESTYLE also, to delete the version subclasses. 2023-06-19 Reini Urban spec: ditto for HATCH.paths[].polyline_paths the preprocessor got confused and produced wrong .i files spec: free HATCH_gradientfill already covered SINCE with free already checks from_version spec: fix wrong HATCH.segs they are really in paths[].segs *-check: support DS_libereco_R20* dwgs enable teigha on r9-r11 no test/$b.dwg copy 2023-06-16 Reini Urban spec: fix HATCH.pixel_size roundtrips by storing the calculated has_derived flag into the json spec: fix VX_CONTROL entries handle type dedected by ODA roundchecks encode: always re-calculate bitsize in START_HANDLE_STREAM fixes json roundtrip in example_2000 with ELLIPSE (BE 210 differences) we should check for floats, plus strings. *-check: support -v5 argument spec: remove wrong UNKNOWN_BITS_REST in STYLE this was the handles, not some secret bits. CRC is now ok again, ODA complains now not about the style but the ELLIPSE spec: fix PLOTSETTINGS (and LAYOUT) dxf order 2023-06-15 Reini Urban preR13: move old entities to stable for the importers 2023-06-14 Reini Urban decode: fix r2007 Section[%d]->pages[%d] overflow check Fixes GH #763 add --enable-debug support to dxf?-check tools debug: alive is fixed dxf not yet 2023-06-13 Reini Urban dxf: rename TABLECONTENT.dxfname back to TABLECONTENT it was wrong. see example_2000.dxf injson: skip unneeded fixup Type dwgadd: add CHK_MISSING_BLOCK_HEADER to ensure hdr is nonnull encode: fix double-free of klass->dxfname of TABLECONTENT encode: fix TABLECONTENT type fixup ignore the given dxfname there, rather search by class id --enable-debug only decode: more precise bit_read_TV overflow checks for preR13, when we need to read 2 byte lengths, not BS decode: skip earlier on FIELD_VECTOR_T overflows to avoid chunk strings (e.g. invalid utf-8) in the json. Fixes debug build of import of json example_2000 with DIMASSOC.xrefpaths 2023-06-12 Reini Urban dxfclasses: -Wlto-type-mismatch tinycc: -C -E is invalid, only -E avoid math macro redefinition unit-tests: error: M_PI_2 redefined unit-tests: add _CAST macros where needed. all other field checks are now again type-strict 2023-06-11 Reini Urban remaining -Werror fixes suppress -Wmaybe-uninitialized (false positives), -Wformat and -Wstringop-truncation. Mostly with ubsan or macOS. 2023-06-09 Reini Urban config: add --disable-werror for autoconf and cmake. fatalize all warnings fix clang -Wtautological-constant-out-of-range-compare comparisons short > 0xc0000000 at compile-time encode: int vs uchar truncation m4: fix mingw gcc -Wformat-y2k probes mingw gcc requires -Wformat with the -Wformat suboptions encode: long to short truncations indxf: silence wrong -Wstringop-truncation https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88780 esp. on old mingw gcc dwgadd: formatting only 2023-06-08 Reini Urban dwgadd: -Wmaybe-uninitialized encode: -Wmaybe-uninitialized decode_test: pragma pack warning with msvc. warning C4103: alignment changed after including header, may be due to missing #pragma pack(pop) outdxf: fix unsigned loop overflow which never goes < 0 when decr len -= 255. Fixes GH #759, thanks to @weikenxq 2023-06-08 Michal Josef Špaček Improve flags_r11 2023-06-07 Reini Urban json: fix json_write_TF \\ quoting Fixes GH #756 2023-06-07 Michal Josef Špaček To readable code Remove trailing code Fix size of APPID table record in preR13 2023-06-05 Reini Urban add: formatting only add: support and document pface triangles add: fix r11 pline and vertex flags and improve the examples for 3D. Still wrong flags all-over though. Fixes GH #754 2023-06-03 Michal Josef Špaček Sort EED codes Fix conversion of appid to JSON 2023-06-02 Reini Urban dwgadd: add HEADER.point support Fixes GH #750 2023-06-02 Michal Josef Špaček Identify VX is_on option Identify VX variables 2023-06-02 Reini Urban dwgadd: fix crazy dynapi string issue char text[120] and &text is different as a pointer to s heap string. we rather deref it twice for all buffers and structs, than fixing the static fixed buffers. Fixes GH #747 2023-06-02 Reini Urban add: add tests for HEADER texts and other 2023-06-02 Michal Josef Špaček Remove trailing "1" from log output Fix parsing of HEADER text value 2023-06-02 Reini Urban rename the _R11 Dwg_Object_Type_r11 type values to _r11 Rename the _R11 Dwg_Object_Type_r11 type values to _r11, to avoid conflicts with the POLYLINE_R11 fixedtype. This is preparation to add POLYLINE_R11 entity 2023-06-02 Reini Urban add: forgot SEQEND.type in dwg_add_Attribute fixes r11 dwgadd.example_r11 2023-06-02 Reini Urban encode r11: refactor encode_preR13_entities blocks might be in between normal entities, see dwgadd.example_r11 instead pass an enum arg for entities, blocks or extras, and decide there then, what to emit. Fixes GH #746 2023-06-01 Reini Urban json: fix TF slack regression A TF string of WIDE\0W should be printed with full slack. Fixes GH #745 2023-05-31 Michal Josef Špaček Run prepared tests 2023-05-31 Reini Urban outjson: fix json_write_TF null-deref handle null strings as "" Fixes ossfuzz 58904 indxf: honor version for default HEADER strings FINGERPRINTGUID and VERSIONGUID must be wide as default, or bit_convert_TU will overflow later. fuzzing bug found by coolkingcole huntr.dev/bounties add: no PLOTSTYLE placeholder Improve bit_read/write_BE tests 2023-05-31 Reini Urban actions: no ACTIONS_ALLOW_UNSECURE_COMMANDS upgrade to ilammy/msvc-dev-cmd@v1.12.1 for node Node.js 12 actions are deprecated upgrade to lukka/run-vcpkg@v11 for vs2019-ninja dwgadd: fix int vs float decisions now also with checking the target size and type. (stack-overflows) Fixes GH #741 2023-05-31 Michal Josef Špaček Add tests for bit_read/write_TV Add tests for bit_read/write_TF 2023-05-30 Reini Urban fix FORMAT_MC minor type errors wrong unit-tests and improve obj.type to BS (short) -fno-strict-overflow warning with clang encode: wrong Empty TF with length 0 warning and dont log "(null)" [T] encode: fix r14 write_BE no r2000+ default bit dwgadd: more TRACE dwgadd: add examples with header floats to parse dwgadd: scanf float before int Fixes GH #741 2023-05-29 Reini Urban fix 32-bit handle sizes 32bit did not zero the higher bits, leading to too high handle values with the add api. msvc: no /lm with cmake msvc: ucrt has sys/stat.h fixes last msvc warning add_test: MSVC truncation warning gperf: silence one more truncation warning add extra ubsan action workflow asan+ubsan runs into the 60min timeout add -m32 action workflow for the 32bit write handle bug actions: -O1 for asan,ubsan to catch more UB's add_test: ok many objects alive.test: silence the libtool prefix STYLE: debug UNKNOWN_BITS_REST 2023-05-27 Reini Urban fix r11 -Wstringop-truncation __builtin_strncpy specified bound 32 equals destination size. detected with -O2 -fsanitize=undefined enforce -fwrapv esp. with broken gcc See https://thephd.dev/c-undefined-behavior-and-the-sledgehammer-guideline gcc removing bounds checks without any warning dwg_api: clang-format some macros encode: wrong mingw32 formats, size_t add_test: debug dwg_getall_OBJECT failures on mingw 32bit decode: log read_BE fields (default or not) encode: log write_BE fields (default or not) 2023-05-25 Michal Josef Špaček Regenerate dynapi 2023-05-24 Michal Josef Špaček Fix preR13 DIMARROW header variable The name DIMARROW is used in r1.4 DXF format and it's different that DIMASZ Improve unknown variables in preR13 2023-05-23 Michal Josef Špaček Fix preR13 SHAPE entity logging Identify x_ang in preR13 POINT entity Add preR13 DIMENSION_RADIUS/DIAMETER extrusion 2023-05-22 Michal Josef Špaček Fix preR13 DIMENSION_LINEAR extrusion Identify EXTRUSION in preR13 ATTRIB/ATTDEF entities Add preR13 point extrusion 2023-05-20 Michal Josef Špaček Fix vertical alignment in preR13 ATTDEF entity Remove obsolete comment Fix vertical alignment in preR13 ATTRIB entity 2023-05-18 Reini Urban r11: skip BLOCK_HEADER *MODEL_SPACE on output encode: more missing size_t's r1.4 encode: keep deleted and unused entities json-check: no teigha for r1.4 spec: rename ENDREP fields to avoid the json magic with num_ fixes json roundtrips 2023-05-17 Reini Urban silence uninitialized vars warnings for AFL fuzzing injson: protect overlarge xdata strings change ulong to size_t. msvc size_t truncation warnings use size_t (64bit) for the windows long problem, instead of unsigned long (32bit). which is a problem for large files on windows. use the %zu formatter throughout. indxf: msvc SCANF_2X has "%2hhX" 2023-05-16 Reini Urban more WINE test fixups dxf*-check: better teigha checks from json-check programs: add -I for config.h decode r11: avoid double evaluation in r11 HANDSEED esp. with mingw add wine support for programs tests 2023-05-15 Reini Urban no inline for be64toh 2023-05-13 Reini Urban gperf: enforce size_t and fix it up via regen-gperf, where needed fix gperf on macOS macOS 12.6.5 lies about its gperf version, using size_t as 3.0 c++ compat for programs, examples just it does not link yet indxf: full c++ compat by additional macros. but we get better type checks in the rest regen-perf: major c++ compats get rid of deprecated register keyword. regen with gperf 3.2 note that macOS gperf says 300, but emits size_t! minor c++ compat encode: fix 2x string_area, zero-padding re-add the zero to strings. (compared with sources) auxheader padding. clear APPID_CONTROL size to recalc when added entries. dxfb-check: new debian pkg ODAFileConverter extend all handle values to 64bit the eed entity handle needs 8 byte. so the handle.value and absref would too. use strtoull for eed.5.entity longlong values otherwise it would overflow. extend handle values to 64bit got dataloss on r11/ACEB10 EED.5.entity values via json 2023-05-13 Michal Josef Špaček Fix version of AutoCAD for preR13 entity types 2023-05-12 Reini Urban dwggrep: fix print_match without PCRE don't double convert from UCS-2 to UTF8 injson: fix 32bit RLL setters long is not big enough for RLL there. detected with 32bit asan 2023-05-11 Reini Urban encode r9: fix numentities calculation and patchup no extras. and write the correct value. fix blocks entities calculation. write TF slack to json, write \0 as \u0000. from json, use json_fixed_string. encode: all TF strings must now be of adequate size (check in_dxf) dxf2dwg: dat-> . confusion 2023-05-11 Michal Josef Špaček Merge pull request #723 from michal-josef-spacek/fix_warning Fix warning with logging of addr 2023-05-10 Michal Josef Špaček Fix warning with logging of addr 2023-05-10 Reini Urban encode r11: avoid ending junk injson fuzz: fix dwg_next_handle for !dwg->num_objects r11: fix writing r11 handles, change json for handles change json handle format to size 3 esp. for object handles. we need to write the size fix writing r11 handles, analog to read_H encode r11: fix EED, skip handle r11 EEDs dont read/write the appid handles, they use the appid_index instead fixes writing ACEB10_r11 -v5 log the handles position (before) 2023-05-09 Reini Urban encode r11: fix extras section calc. jump_entity_section for JUMP (in_json). extras starting off from the last block index. 2023-05-08 Reini Urban json.test: fixed json roundtrips encode: fixup address patchup evert part of 0d00fd5c203ded9b495d187819558ee5747d6a32 fuzz injson: stack-overflow with over-long fixed strings. fuzz encode: protect in_postprocess_SEQEND fuzz injson: protect >dashes_r11[12] oob allow max 12 elements fuzz injson: protect from missing version fuzz: fix dwg_find_first_type oob dwgwrite: fix invalid type argument of -> only detected with afl-gcc-fast encode r11: fix header.blocks_start without blocks write the sentinels, set proper blocks_start. encode r11: support EED types 0 and 3 2023-05-07 Reini Urban encode r10: skip table crc encode r11: unify CASE_ENCODE_TYPE no special-cases anymore. the flag_r11 fixups were wrong m4: fix -D_FORTIFY_SOURCE=2 probe it didnt error, only warn encode r11: fix tbl->flags_r11 for r9-r11 encode r11: init on valid header.dwg_version = 0 and don't init it away. encode r11: encode_preR13_section with spec tables Fixes GH #720 temp. regen-dynapi 2023-05-05 Michal Josef Špaček Fix vertex entity flags Fix POLYLINE and VERTEX entity decoding in preR13 Fix detection of POLYLINE and VERTEX entities in preR13 There are common POLYLINE and VERTEX entities in preR13. There are concrete POLYINE and VERTEX entities later. This is detection of concrete entities and use code in dwg.spec for precise decoding. 2023-05-05 Reini Urban encode_r11: fix VPORT simple json roundtrips now ok, blocks not yet decode_r11: fix sentinel search diagnostics log: fix -larg common.c: DWG_SENTINEL_R11_ simplier sentinel values in comments to be searched for in logs decode_r11: delete unused comments/code log.in: fix -llogfile option harmonize SENTINEL_R11 macro/enum names and simplify the case switches decode_r11: search sentinel +- 200 bytes around encode r11: fix LTYPE.pattern_len which broke dashes_r11[11] api: rename LTYPE.num_dashes to numdashes with r11 the vector is fixed-size 12, not dependent on num_dashes. hence we need to write it into json, and read it back in. without the "num_" vector size magic. encode r11: fix STYLE.bigfont_file decode_r11: dont overwrite block_entity->handleref.size now json-check r11/entities-2d fails at STYLE.bigfont_file api: change BLOCK_HEADER.flag2 to RSd simplier and more logical. defaults to 0xffff 2023-05-04 Reini Urban encode r11: disable encode_preR13_DIMENSION it changes its flag_r11 for no good reason. we rather rely on the fixedtype calcuclated earlier. fixes a couple of roundtrip errors encode r11: fix dwg_add_handleref for empty absref we cannot search the handles when we haven't resolved them yet. 2023-05-03 Reini Urban encode r11: deleted entities also for easier comparisons injson: special-case TFv table sizes because we need to access them beyond their length. we would need json_fixed_string for this, but realloc is also ok, because the dynapi registered these strings as TV, not TF. decode_r11: auxheader.R11_HANDSEED leak encode r11: fix add with non-consecutive table records when using an arbitrary add api, we cannot ensure that all table records are one after each other. encode r11: sync UCS with spec encode: honor UCS.ucs_elevation when encoding from r2000+ to earlier versions. but the default ucsorg is just a 2RD, I don't see any flag value to add the elevation there. decode_r11: improve VERTEX type detection, rename r11_auxheader See GH #713. use the pline type for subsequent vertex types. add VERTEX_MESH opts. reformat some encode funcs, rename r11_auxheader funcs encode r11: write_sentinel as macro and skip writing deleted r11 entities. it would be useful, but there are encode problems with json and dxf in the type mapper, I couldn't find good fixes for yet. json.test: todo preR13 roundtrips json-check: no teigha write encode r11: write mand. extras sentines and set extras_start encode r11: common tbl used, add tbl crc encode r11: move r11 check into the function encode r11: patch the section address'es because we dont know the entities_end address yet, when we write the section hdr's. re-use the static Section[id].address for this, which is only written later. json: skip the final \r in acis_data strings esp. for json, where we did split only on \n, not \r\n. encode_r11: better write_sentinel with -v4 logging, and just the ID remove unneeded bit_write_sentinel default to r11 numheader_vars = 205 WIP encode r11: add missing sentinels because we still get SECTIONNOTFOUND errors json.test: extend to all versions example?r13 has an encoding problem and ACEB10_r11 cannot be read back in doc: r11 doc updates and dwgread has no --as VERSION argument (yet) 2023-04-29 Reini Urban encode: undo minimal DXF hack creating invalid header strings e.g. gen-dynapi for SHAPE.style_id 2 r11_idx => name preR11 leaks fixed preR13 imports and outdxf dont leak anymore. Fixes GH #466 encode_r11: calculate HANDSEED fix preR13 free CMC somehow the name strings became invalid encode_r11: set HEADER.numentity_sections to 3 decode_r11: non-global dwg_decode_preR13_handleref add to the refs vector. to avoid duplicates, and to avoid BLOCK_HEADER.block_entity leaks. examples/dwg2svg2: prefer paperspace if there are paperspace entities, only output them. Else all modelspace entities. examples/dwg2svg2: API fixes for preR13 use fixedtype, check if paperspace exists dxf: fix dxf_print_rd reduce precision is still broken, disable it. fixup for d7f200788 fixes dxf-check encode r11: calc. the control table sizes also set entities_end. See GH #716 dxf r11: fix HANDLE (style, 2) but we really should resolve the style_id to its r11 name decode_r11: set handles for all, fixes get_first_owned_block() without proper handle we cannot resolve entities, like in get_first_owned_block decode_r11: set hdr->block_entity, endblk_entity json.test: stricter check_roundtrip 2023-04-28 Reini Urban dxf.test: stricter check_roundtrip 2023-04-27 Michal Josef Špaček Add missing logging of vertex flag in VERTEX_PFACE in R13 2023-04-27 Reini Urban helpers: portable make addprefix workaround add shellcheck target. add old tests to roundtrip testers 2023-04-27 Reini Urban encode: more fuzzing assertions => error overwriting dat->chain at pos 0. add some more basic checks. like NULL checks and overflow checks. all detected by llvmfuzz 2023-04-27 Michal Josef Špaček Add logging of SOLID R11 opts 2023-04-26 Michal Josef Špaček Fix parsing of preR13 tables Table definitions in dwg.spec need obj->size, which wasn't here. 2023-04-26 Reini Urban fix dwg2SVG for preR13, wrong type BTW: we see all these new errors, because we never before iterated over r11 entities. log: timeout 30 with bigger files automatically eg td/2007/fischer_anchor_base_and_dynamic_blocks.dwg unit_testing: changed the test-old files space to _ add exit 1 for helpers, disable broken shfmt shfmt 3.4.3-1 creates broken if indents dxf: dxf_cvt_tablerecord triggers at r2000, not r13 e.g. TEXTSTYLE STANDARD or Standard 2023-04-25 Reini Urban latest shellcheck 0.9.0, shfmt dxf: resolve r11_idx table names FIELD_HANDLE_NAME via dwg_handle_name() dwg_api.h: cygwin/newlib already has __nonnull_all dxf: $UCSXORI preR11, FLATLAND 70 r20 only dxf: fix dxf_print_rd trailing spaces no trailing spaces dxf: skip *MODEL_SPACE BLOCK before r11 decode_r11: set ownerhandle->r11_idx, entities[] logging dxf: version-specific table entries decode_r11: parse even empty tables Fixes GH #709 we need to parse the sentinels and add the control table objects, even if the table is empty or has invalid entries 2023-04-24 Reini Urban encode: -Wmaybe-uninitialized first_block encode preR13: encode missing last entity/block also fix writing all entities r1.x, not just until the first block. with r1.x there is no blocks section. Fixes GH #702 automake: rename SH_SOURCES to shell_sources dont trample on reserved names for shfmt only decode_r11: fail on sentinel error or empty table number or size. Fixes GH #708 dwggrep: formatting only missing #include AX_STRCASECMP_HEADER geojson: fixed for preR13 fixedtype, not type. Fixes ossfuzz 58306 indxf: accept lowercase DWGCODEPAGE e.g. example_r13.dxf has "ansi_1252" appveyor: on cygwin set git safe.directory this fixes the cygwin build on appveyor appveyor: remove cygwin32 Cygwin is not supported on 32-bit Windows decode: check failing mallocs in spec log: support --big, HACKING: recommend tcc --big is needed to bypass timeouts 2023-04-23 Reini Urban dwg.in: check json,dxf,dxfb for fuzzed input 2023-04-21 Michal Josef Špaček Fix blocks_size for preR13 Constant 0x40000000 was added in AC1001 version to blocks_size 2023-04-21 Reini Urban appveyor: deploy libiconv-2.dll also Fixes GH #700 dxf: fix dxf_fixup_string, uninitialized _buf detected by valgrind with MTEXT disable failing setup-python-libxml2 Requirement already satisfied 2023-04-18 Reini Urban codeql: update checkout also to latest node 16 codeql: update to v2 https://github.blog/changelog/2023-01-18-code-scanning-codeql-action-v1-is-now-deprecated/ 2023-04-18 Reini Urban dxf: fix wrong floating truncation and format use %G, not %f, don't strip overlarge ints. now: $PEXTMIN 10 1E+20 before: $PEXTMIN 10 100000000000000000 Fixes GH #687 2023-04-18 Reini Urban unset HAVE_PYTHON_LIBXML2 on cross Fixes GH #698, for 32bit cross e.g. python demand-loads the shared libxml2 without honoring libpath hints common_cvt_TIMEBLL_tests: fix 32bit overflows 2023-04-18 Reini Urban check calloc overflows, esp. with 32-bit New alloc limit: "requested allocation size 0xd0000618 (0xd0001618 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0xc0000000 (thread T0)" detected by fuzzing. Fixes GH #694, #695, #696, #697 2023-04-18 Reini Urban more FORMAT_UMC, esp. for 32-bit decode_r11: add BLOCK.name as 2 2023-04-17 Reini Urban decode_r11: set BLOCKS header (owner) to generate the entities[] 2023-04-17 Reini Urban r11-iter: resolve JUMP's WIP add missing BLOCK_HEADER.entities[]. resolve extras section JUMP entities. GH #635 2023-04-15 Reini Urban actions: apt-get update needed now dxf.test: skip symbolic links which I made locally for testing decode: fix bit_read_UMC @arturred at GH #386 was right, UMC may need up to 8 byte. The #662 testcase works now, and the samples also. Fixes GH #662 and #126. ERR-2 from #386 not yet. 2023-04-14 Reini Urban decode: better recovery from UMC bug reading from the HANDLES stream easily gets corrupted with a wrong read_UMC function. Better recovery logic, and add a unit-test GH #662, #386, #126 and znacky_all_dwg_from_cadforum.cz_2004.log 2023-04-13 Reini Urban injson r11: split MENU into MENUEXT Fixes ossfuzz 57969 bits: change TV-ZERO policy GH #683 write the same length as when reading. dont include the final zero preR2004. encode r11: fix control resolver GH #693 the object_map is only stored with an obj. without it cannot resolve. add more -v4 and -v5 handle resolver logging use less control handles with r11 esp. for out_json. the de/encoding is done elsewhere for r11 still log more handles helper functions (esp. r11 resolver) encode r11: calc the control address with sentinels for r11 json: extend r11 handles to size 3 with absref the default r11 control entries get code 3 (the major r11 usage so far) also parse the r11 _control address 2023-04-12 Reini Urban encode r11: add missing UCS - VX sections more r11 _CONTROL object support which is not yet de/encoded via spec, but use it for JSON at least. rename tbl->flags to tbl->flags_r11 and add it to JSON. encode r11: control table flags_r11 and search GH #693, TODO: address and num 2023-04-11 Reini Urban bit_read_T32: fix size overflow With fuzzed input, GH #692 encode: don't skip entities in blocks section wrong entmode encode r11: eed write RS not BS encode: wrong BLOCK_HEADER.unknown_r11 With the new diagnostics of the previous commits a new ACEB10-rewrite.dwg problem appeared: ERROR: Wrong BLOCK.number or size ERROR: LAYER.size overflow on encode. decode_r11: catch wrong table size or number in the header only warn at the first violation, because the number can be wrong. only error when the number is wrong later. Fixes ossfuzz 56972 decode_r11: fail in fuzzed overlarge entities_size e.g. ossfuzz 49618 add make check-ossfuzz target dxf: Assume DWG file similar to json. mostly for ossfuzz reproducers 2023-04-09 Reini Urban bit_TV_to_utf8: handle out of memory use the safer dwg_ref_object() more often protect from use-after-free realloced dwg->objects may not access ref->obj when dirty_refs. 2023-04-07 Reini Urban document the new r11 JUMP entity and EXTRAS section See also https://github.com/LibreDWG/libredwg/discussions/691 2023-04-06 Reini Urban free: skip TABLE/TABLECONTENTS.cells free (workaround) because it's 0x21, not a pointer. Someone is overwriting it, because it's shared with TABLECONTENT. use a subclass instead. --enable-debug only 2023-04-06 Reini Urban unit-testing classes cleanup fix dwg_add_HATCH overflow on HATCH.LWPOLYLINE path segs detected only with c++ fixes strrplc: more checks, truncation warning conversion from 'size_t' to 'const int', possible loss of data fix most C++ type strictness problems and improve jump_entity_section error handling. only in_dxf is missing encode: set dat->codepage encode: refactor encode_preR13_entities GH #689 use from/to indices, not positions. dxfwrite ACEB10_r11.json works now again. 2023-04-05 Reini Urban injson: fix remaining r11 BLOCK,ENDBLK leaks we freed the wrong temp. entities injson: fix r11 section overflow we can read up to VX encode: support eed code 1 (the appid_index) injson: rename POLYLINE_2D.extra_r11 to _text else we get a type error. fix last entity reading (GH #679). support eed code 1 (the appid_index) for ACEB10_r11. injson: accept RSd HEADER r11 injson: forgot VPORT table r11 json: change r11_idx repr, fix color_r11 RCd in_json r11 handles: decode, encode, json json specialize r11 only two elems with signed r11_idx. encode/decode: signed -1 for unused r11_idx, use handleref.size, not the code injson: preR13 special cases codepages: handle dxf undefined as CP_UNDEFINED CP_DWG is gone minor codepage encode and dxf fixes esp. the DWGCODEPAGE dxf versions. accept r11 $DWGCODEPAGE undefined. README: disable-write and codepage updates also the 2 new optional libs API: enable reading preR13 dwg with --disable-write #688 enable the add API with --disable-write, but skip some postR13 postprocessing from encode. 2023-04-04 Reini Urban alive.test: add more preR13 tests example_r13 and r1.4/entities are stable. r11/entities r10/entities r2.x/entities fail rw. FIXME: chibicc fails at bit_read_4BITS_tests -Winline eed_need_size gcc4 says: eed_need_size.isra.3: call is unlikely and code size would grow tcc found missing returns bits: add asian cp tests fix bits loglevels for warn/errors windows clang-cl can scanf %2hhX ctest: use wine bits: more msvc truncation fixes conversion from 'size_t' to 'const int', possible loss of data. bits_test segfaults with vs2019 support bit_TV_to_utf8 without iconv TODO: asian codepages TV to utf-8, e.g. gh90-dxf_r14.log with "����1", ie. "1" add our own codepage mappings iconv is way too instable. also fix the CP_JOHAB hole. wip iconv bits: add bit_u_expand convert all \U+XXXX sequences to UTF-8 iconv: add codepages.c and helpers via iconv stabler bit_TV_to_utf8 conversion abstract codepage API, convert via iconv cmake+configure: add AM_ICONV probe from gcc also to cmake via FindIconv() add dxf_set_DWGCODEPAGE and enum Dwg_Codepage mingw: check less with mingw we dont want to wait 1hr for the artefact fix wrong header.section_info size allocation detected by c++ compilation tests 2023-04-03 Reini Urban dynapi: free old malloced values generally cppcheck was right about the leak indxf: free old strings in dwg_dynapi_header_set_value() there is a leak in dwg_dynapi_header_set_value() in in_dxf.c:1288 indxf: fix DIMENSION_LINEAR.oblique_angle old name ext_line_rotation DXF 52 indxf: fix dxf_read_rl: RL overflow esp. with colors, like C2FFFFFF indxf: fix dxfname leaks with dimensions indxf: fix AcDb*ViewStyle leaks of skipped pairs clang-format off for else_do_strict_subclass chains ... free: no dxfname leaks alloced on indxf or injson dxf: add SPLINE.fit_pts missing from scenario 1 for dxf and free (e.g. added via indxf). not yet calculated. indxf: dont overwrite invalid dwg->header.from_version on indxf we only know the from_version, and still have an invalid header.version. indxf: fix dxfname leaks on errors indxf: fail on missing mandatory CONTROL object Fixes ossfuzz #44483 2023-04-01 Reini Urban examples: support mimalloc in api-only samples we need to use the very same malloc/free calls. Fixes dwg2svg2 free() 2023-04-01 Michal Josef Špaček Identify address in SEQEND entity Address mean begin of sequence (polyline with vertexes or insert with attributes) Log degrees in RD Improve tests for handles 2023-03-31 Reini Urban decode: improve fuzzing overflow on auxheader crc calc Improve on 8651fa27dd2de731e706e2ba09f0d28e4e0dce33 Fixes part 3 of GH #677 bits: stabilize bit_utf8_to_TU for invalid strings Fixes both fuzzer bugs GH #681 poc0.bit_utf8_to_TU and poc1.bit_wcs2nlen hexhive: nice fuzzer! 3dface: rename FACE3D to _3DFACE prefix 2023-03-31 Michal Josef Špaček Add logging of 3dface invisible flag 2023-03-30 Reini Urban dxf_test: fix -Wformat-overflow value is always NULL my_stat: config has no include guard already included before in all cases. avoid duplicate inclusion in_json: support HEADER.layer_colors[128] Fixes GH #676 2023-03-30 Michal Josef Špaček Fix CECOLOR JSON conversion in preR13 Fix CECOLOR in JSON conversion for preR2 Fix SNAPUNIT and GRIDUNIT in JSON conversion for preR2 2023-03-30 Reini Urban add UNKNOWN_BITS_REST for now used for the STYLE slack after bigfont_file. a "A" 4 after the empty bigfont. "num_unknown_bits": 12, "unknown_bits": "4104" See GH #322 decode: fix DEBUG_HERE overflow bit_utf8_to_TU: implement cquoted option yet unused 2023-03-30 Reini Urban bits: fix size truncation warnings from msvc: '=': conversion from size_t to unsigned int, possible loss of data warn and truncate overlong strings. 2023-03-30 Reini Urban outdxf: fix SAB fuzzing sign-confusion 1.: use unsigned length 2.: fix wrong size check for case 9, long len. Fixes GH #677 2023-03-30 Reini Urban decode: fix fuzzing overflow with invalid auxheader_address Sanitize wrong auxheader_address or auxheader_size. Fixes part1 of GH #677 encode: unused var in in_postprocess_SEQEND encode: fix ent->color.alpha add a BLx color.alpha_raw field, so that encode does not loose this information on decode 2023-03-28 Reini Urban header: remove unused STYLE.unknown 2023-03-26 Michal Josef Špaček Fix table logging of is_removed flag Rewrite logging of removed viewport to common way 2023-03-24 Michal Josef Špaček Fix DIMSTYLE DIMALTZ and DIMALTTZ for AC1012 Fix header DIMALTZ and DIMALTTZ for AC1012 2023-03-23 Evgeny Sobolev indxf: Fix last entity for block 2023-03-23 Reini Urban json: assume DWG type for fuzzer input 2023-03-22 Reini Urban add JUMP unit-test PR #670 2023-03-21 Michal Josef Špaček Identify JUMP entity Identify id for DWGCODEPAGE in DXF Remove duplicit codepage 2023-03-20 Michal Josef Špaček Fix EED appid index variable in preR13 Fix TILEMODE header variables in preR13 2023-03-18 Michal Josef Špaček Fix EED layer for preR13 This is RS not RC 2023-03-17 Michal Josef Špaček Fix LEADER path_type and annot_type Fix indentation in LEADER logs 2023-03-16 Reini Urban spec: fix LEADER.hookline_on which apparently is bit 8 off in arrowhead_type. not spec'd in ODA, and differently implemented in their theiga dxf converter. Fixes GH #656 2023-03-13 Evgeny Sobolev Fix incorrect read w-coordinate for spline 2023-03-01 Reini Urban Dockerfile.centos7: merged centos7 to master 2023-03-01 gongxy <83904580@qq.com> Optimization find_prev_entity,Accelerate DWG generation. 2023-03-01 Reini Urban avoid which, use POSIX centos7 has an incomplete endian.h centos7 has only automake 1.13.4 Move Dockerfiles into build-aux to avoid copying all the test-data to the docker daemon 2023-03-01 Michal Josef Špaček Fix tables in preR13 Fix vx table in preR13 Fix view table in preR13 2023-02-23 Reini Urban cmake: -DENABLE_LTO=Off for faster build times Support --enable-mimalloc 2023-02-22 Reini Urban minor clang-tidy issues 2023-02-20 Reini Urban actions: add vs2019-ninja a bit complicated, but a good documentation 2023-02-19 Reini Urban docs updates Merge branch 'smoke/VS2019' add Visual Studio 2019 Support CI: cmake msys and msvc error search msvc: fix unit-tests 2023-02-18 Reini Urban msvc: fix cmake packaging new dll name. enable tests when cross-compiling on linux msvc: out_json warnings fix VS2019 type cast see the VS2019 action: error C2440: type cast: cannot convert from BITCODE_TIMERLL to BITCODE_TIMERLL 2023-02-18 Reini Urban VS2019 specific fixes, __VA_ARGS__, __attribute__, suppress warnings * __VA_ARGS__ macro support * __attribute__ only with __GCC__ * suppress C4101 uninitialized recount warnings, and strcpy insecure warnings. * no proper const var support (with the even weirder error: cannot allocate an array of constant size) * strict dllexport/dllimport decls: fix various omissions clang-cl can handle it, VS2019 errors. See the new VS2019 CI 2023-02-18 Reini Urban add msvc support now that I can cross-compile it on linux via clang-cl (cmake and ninja), and added a CI for VS2019 on Windows. via ucrt, so only newer Visual Studio's. See previous commits. Fix some wrong types along the way, clang-cl x86_64 finds much more deviating integer sizes. WIP 2023-02-18 Reini Urban add VS2019 CI 2023-02-17 Reini Urban tcc fixes wrong dwg_get_HEADER_utf8text (tcc has HAVE_NONNULL) 2023-02-15 Reini Urban add make clang-tidy target and probes Closes GH #645 clang-tidy: fix some bits.c violations 2023-02-14 Reini Urban apply regen-shfmt add shfmt checks cvt_TIMEBLL: fix tm_hour and tm_mday GH #639 unit-test: add cvt_TIMEBLL tests, catch GH #639 2023-02-14 gongxy <83904580@qq.com> fix cvt_TIMEBLL Interpretation of date.ms 2023-02-13 Reini Urban Merge branch 'smoke/polyline_has_extra-gh548' regen-dynapi with new DWG_TABLE detection POLYLINE.extra_r11: variable size 16 or 17 polyline.layer with IN_EXTRA is really the offset GH #548. Log the offset spec: other r11 extra, use 2 RLLs instead they indeed do like some encoded links into the extra entity section, for the replaced curve_fit plines, sitting there. See GH #548 spec: OPTS_R11_POLYLINE_HAS_EXTRA = 0x8000 See GH #548 HAS_EXTRA means that this entity is replaced by entity in extra entity section. 2023-02-12 Reini Urban README, NEWS Updates Merge branch 'smoke/preR13-tables' free: fix block_control.entries leak/double-free preR13 We know the number of tables, but add_ may add some beforehand. free: fix auxheader.R11_HANDSEED leak decode_r11: remove dead code decode_r11: fail on critical section errors only we properly save/restore dat now. 2023-02-11 Reini Urban decode_r11: check crc decode_r11: setup and link control tables GH #538 decode_r11: move blocks,extra_size calc earlier for logging only out_json: no MENUEXT as it cannot be imported. TODO: split on import or downgrade. GH #636 header: rename r11 entity section names, fix r11 in_json as before: blocks and extras. extras seems to be similar to AcDs sections, additional entity data. (like calculated spline curve points) spec: add DWG_TABLE, fix dwg_decode_ visibility the tables are non-static for r11 decoding, the DWG_OBJECT stays static decode: support for preR13 objects no handles, no eed too early. GH #538 decode: move r11 tables to dwg.spec GH #538 2023-02-11 Michal Josef Špaček Remove duplicit xline command 2023-02-09 Michal Josef Špaček Fix aux header 2023-02-09 Reini Urban fix rw 2.10/entities dont endless loop on misread objects, invalid types decode: replace if-else chain with switch-case catch errors, simplier code improve dwg_sentinel a bit check out-of-bounds, use const fixup r11 sentinels 2023-02-09 Michal Josef Špaček Report undefined data before tables Fix sentinels in preR13 tables Improve preR13 entity blocks encoding We have three blocks of entities. The change is simplifing decode_preR13_section() and improving decode_preR13_entities() to handle all things in entity section. Including sentinels in R11. Add r11 sentinels Rename sentinel from DWG_SENTINEL_R11_HEADER_END to DWG_SENTINEL_R11_ENTITIES_BEGIN Fix name of variable which mean number of sections which have entities 2023-02-09 Reini Urban decode r11: improve broken obj->size avoid an endless loop there. testcase: ./rw r2.10/entities more __nonnull checks from internal common.h is_valid_tag: re-add NULL check Fixes ossfuzz 55769 regen-dynapi 2023-02-08 Michal Josef Špaček Fix VX table 2023-02-08 Reini Urban unit-tests: fix 2 -Wredundant-decls for dwg_is_valid_tag NEWS: 2 more ossfuzz bugs fixed 2023-02-07 Reini Urban regen-dynapi cppcheck: uninitvar in mpolygon.c Update docs and Copyright years cppcheck: limit unit-testing define combinations cppcheck: suppress wrong preprocessorErrorDirective dwggrep.c:1970:0: error: failed to expand LOG_ERROR, Wrong number of parameters for macro LOG_ERROR. [preprocessorErrorDirective] cppcheck: one more memleakOnRealloc, in htmlwescape cppcheck: Fix dwgbmp.c Resource leak: fh [resourceLeak] cppcheck: suppress wrong memleak warning we copy just the pointer, not the string. cppcheck: suppress wrong double-free warning cppcheck: fix dxf_read_file memleak on error add cppcheck integration 2023-02-06 Reini Urban bits: fix cppcheck Common realloc mistake: str nulled but not freed upon failure [memleakOnRealloc] autoconf -Wsyntax warning dwg_api: fixup wrong EXPORTs mingw: upload src/dwg_api.i on failure and the config.h. Press Cancel Workflow on error, after the artefact upload, for faster finish. dwg_api.c: add missing EXPORT's harmless, but better than deviating from the header. fixup doxygen comments actions: make -j ... and don't run make check on tags bump LIBREDWG_SO_VERSION to 0:13:0 for the changed add and r11 API spec: protect from wrong PROXY_OBJECT overflow errors on unaligned data. but we read whole bytes with TF dynapi: fix -Wdiscarded-qualifiers encode: fixup invalid tags accept them, just warn better integrate dwg_is_valid_tag 2023-02-05 Reini Urban dwgadd: -Wmaybe-uninitialized with older compilers importers: use dwg_is_valid_tag checks but no conversion, just ignore wrong tags. See GH #628 2023-02-05 Reini Urban api: add dwg_is_valid_tag checks for the add API. TODO encode and importers, but they need to upcase the lc letters See GH #628 2023-02-03 Reini Urban add: more r11 opts and flags, esp. POLYLINE/VERTEX but still encode is broken for these dwgadd: fix ATTDEF,ATTRIB tag to any string Fixes GH #628 NEWS: Update fixed fuzzing bugs change versions: add R_2007a, remove unused checked against ODA. spec r11: add MENUEXT support Fixes GH #626 2023-02-02 Reini Urban decode: initialize sp from src this time -Wmaybe-uninitialized was correct. only caught with -O2 2023-02-02 Michal Josef Špaček Fix dwgadd attdef and attrib parsing attdef and attrib prompt could be FMT_ANY attdef default value could be FMT_ANY 2023-02-02 Reini Urban decode_r11: initialize used typical wrong -Wmaybe-uninitialized dwgadd: version specific examples temp. created for each test dwgadd: fix scan_pts swallowing the last newline which lost the dimstyle init dwgadd: add MLINE support, leading to a new error added better diagnostics dwgadd: finish the trace logging dwgadd: fix angle stack-overflow convert to the right type. Closes GH #611 dwgadd: fix scan_pts3d slack, and scan_faces dwgadd: fix viewport, add layout warning dwgadd: fix "text" parsing and add some logging. we need to parse until the next " Fixes GH #609 dwgadd: add lwpolyline and polyline_pface broken: text, mline, layout dwgadd: support angles in degree See GH #611. Fixes GH #610 Also see GH #609: wrong sscanf usage. 2023-02-02 Michal Josef Špaček Fix extra flag It's after entity options -> Cleanup of color_r11 2023-02-01 Michal Josef Špaček Add start_width and end_width to POLYLINE_3D entity 2023-02-01 Reini Urban dwgadd: support add_ATTRIB See GH #619 spec: BLOCKGRIP comments only dwgadd: fix clang-format also our public headers dwgadd example fixups 2023-02-01 Michal Josef Špaček Add dwgadd example for AutoCAD r1 Fix dwgadd example attdef is entity which define attribute, must be before main attribute entity. Support attdef entity in dwgadd Export dwg_add_ATTDEF function attdef is regular entity, independent on other 2023-02-01 Reini Urban LOG_FLAG_R11 space regen-dynapi for POLYLINE_3D.extrusion 2023-02-01 Michal Josef Špaček Fix POLYLINE_MESH curve_type Fix curve_type logging Fix polyline 2d curve_type Identify invis_flags in 3DFACE entity Fix line entity unknown Size of entity is variable In case with extrusion is 56+24 Fix polyline 3d curve type Fix polyline_3d extrusion Fix UCS used Fix UCS table Fix preR13 VPORT table Use used variable from COMMON_TABLE_FLAGS Move R11 used to PREP_TABLE Fix vport table flag 2023-01-31 Michal Josef Špaček spec: Fix tag and prompt in r11 attdef entity 2023-01-31 Reini Urban decode: search for section_map_address Closes GH #617 ODA fails with "Unexpected end of file", so failing looks ok. decode_r11: fix AUXHEADER decode_preR13_section_chk Fixes fuzzed GH #616. tbl overflow without bounds check 2023-01-30 Reini Urban fixup add API errors 2023-01-30 Michal Josef Špaček Fix presence of ATTDEF entity Fix presence of some entities in preR13 Fix encoding of block name in pre R_2_0b Fix LINE in pre R_2_4 Sort code blocks by AutoCAD version 2023-01-30 Reini Urban spec: simplify to PRER13_SECTION_HDR() spec: move preR13_section_hdr() into header_variables_t11.spec massive simplification decode: fix decode_preR13_section according to header.num_sections. Fixes GH #591 global HEADER.num_sections and sections num_sections for the allocated section[], sections read from the header. encode r11: header crc and sentinel only since r11 decode: fail on wrong r2000 Classes header Fixes GH #615 fix decode ubsan: align src or dst in bfr_read_32,64 2023-01-28 Michal Josef Špaček Fix arc start and end angles We need to convert to radians 2023-01-26 Reini Urban log SPLINE flags, rename splineflags1 to splineflags rename Dwg_Section_Type_R13 to Dwg_Section_Type_r13 section harmonization. triggered by GH #591, which I cannot repro. 2023-01-26 Michal Josef Špaček Cleanup comments 2023-01-25 Reini Urban decode: fix overflows with fuzzed entities_start Fixes GH #594 entities_start may be < 2 objects may be size 0 and address < 2, leading to overflows 2023-01-25 Reini Urban logging: simplify block_offset_r11, RLx is good enough Update cirrus to freebsd-13-1 decode: fix r11 blocks_start GH #589 analog to blocks_end bump file codas and modifications 2023-01-25 Michal Josef Špaček Identify PUCSNAME Identify UCSNAME in preR13 This is index to UCS table Fix gen-dynapi.pl for debian sysinc Debian has includes in arch dependent directory too Closes PR #604 Identify aspect ratio Closes PR #603 Fix SKPOLY Closes PR #600 Unify and rename unknown_unit1-4 header vars unify between preR13 and postR13 PR #599, squashed Identify flag_3d in preR13 header It's same variable as flag_3d in VIEW table. Not saved to DXF 2023-01-25 Reini Urban endian: probe for htobe64, be64toh (unused) but only with 2023-01-24 Reini Urban spec: cleanup r11 BLOCK actions spec: fix some -Wformat (detected via macOS clang) some wrong types. move ATTRIBUTE_FORMAT from test_common.h to common.h we will need that for smaller logging fix ax_gcc_func_attribute.m4 use -Werror spec: simplify r11 HANDSEED via endian macros also enable all other actions than decode cmake: endian support endian: enable all APPLE extensions for memmem the default from src/config.h _POSIX_C_SOURCE 200809L disables most. endian: define __XSI_VISIBLE 700 only on cygwin clashes with macOS for memmem, which does not work with _XOPEN_SOURCE 700 endian: support macOS and mingw with be conversions endian: enable default endian macros need _DEFAULT_SOURCE for __USE_MISC endian: remove unneeded swaps fix WORDS_BIGENDIAN uncertainties on le, just pass through. mingw detected le but failed with unknown byte order WIP endian: more conversions WIP endian: swap the bits (1) TODO: some writers, handles WIP r2004 endian compat roughly based on GH #120. older glibc need _BSD_SOURCE for the byteswap macros, some _POSIX_SOURCE, newer _DEFAULT_SOURCE. 2023-01-23 Reini Urban fixup unknown_59 size, regen, fixup timezone timezone is a protected global on darwin 2023-01-22 Michal Josef Špaček Fix handseed 2023-01-21 Michal Josef Špaček Fix unit mode header variable 2023-01-21 Reini Urban strncpy for dynapi_test.c spec: check shorter AppInfo on some dwgs. which led to leaks. also fix a wrong static overflow check use more older test-data dist the 3 new r9 files 2023-01-21 Michal Josef Špaček Add r9 test files Add unknown_r11 to VIEW table This variable is similar as in other tables for this version of DWG file 2023-01-20 Reini Urban r11: move entites/blocks_start/end to header rename block_addr to block_offset_r11, see GH #483. TODO: write the r11 block_entities. regen the dynapi. decode_r11: improve DIMENSION logging decode_r11: change DIMENSION_ANG3PT as proposed by Michal, GH #587 more minor r11 dims: one dimstyle size error Fixes GH #582 decode: minor 0x8000 harmonization 2023-01-19 Reini Urban r11 dimensions: more ANG3PT fields, more dimstyle Fixes GH #587 decode_r11: fix block entities mask end log flags as hex, add more flag enums and logs undocumented LEADER.pathtype 2 r11: add weird LINE.unknown_r11 GH #586 On some lines only, not backed up by some flag or opts. The DXF misses those 2 numbers. E.g. start: (20.000000, 51.000000) [2RD 10] end: (20.000000, -51.000000) [2RD 11] unknown_r11: (-3.626858, 10.000000) [2RD 0] 2023-01-19 Michal Josef Špaček Fix text_rotation in preR13 Fix xline2end_pt in preR13 Fix preR13 dimstyle 2023-01-18 Reini Urban silence the -Wformat-y2k warning in load_dwg.c 2023-01-18 Michal Josef Špaček Fix DIMENSION_ORDINATE in preR13 Removing of flag2 field Add clone_ins_pt to preR13 Fix dimension entity 2023-01-18 Reini Urban fix dwg_sections_init: renamed, fuzzing GH 581 On a mismatch between dwg->header.numheader_vars and dwg->version, a r11 tbl overflow could happen. Fixes GH #581 add_test: TODO flaky dxf tests GH #572 extend load_dwg to add/update a fingerprint 2023-01-16 Reini Urban re-add probe for attribute format(ms_printf) decode_r2007: fix decompression overflows mostly with fuzzing, GH #578. dst_size may be inexact, pass through the real decomp/data size 2023-01-16 Michal Josef Špaček Fix logging of flags/opts in free Fix LOG_LEADER_PATHTYPE macro Fix log in free mode 2023-01-13 Reini Urban log: strip .DWG also regen-dynapi: block_addr, extra_r11 again fixup r11 EED for FREE and ENCODE 2023-01-13 Michal Josef Špaček Fix color vs pspace Fix insert entity point in preR13 Decode eed in preR13 entities Log open/close in eed Update decoding of eed to preR13 2023-01-12 Michal Josef Špaček Fix table log of flag Fix error in free for BLOCK_HEADER 2023-01-12 Reini Urban GH actions: cancel outdated branch workflows encode r11: handle entities errors rewrite r11: check wrong dwg->cur_index alive.test: fix DISABLE_WRITE check xmlsuite: english wording r11: sync STYLE, fixes bigfont_file leak 2023-01-12 Michal Josef Špaček Fix view table Fix layer table Fix style table Fix VIEWPORT entity id Improve block decoding Identify is_removed flag for tables 2023-01-08 Reini Urban xmlsuite: add ObjectName props xmlsuite: add MTEXT support xmlsuite: allow simple errors, fix double-free but still does not work properly again 2023-01-07 Reini Urban sync dwg.spec from decode_r11 yet unused, GH #538 rename AX_RESTRICT to AX_C_RESTRICT opposed to CC_RESTRICT. https://github.com/autoconf-archive/autoconf-archive/pull/271 r11 VIEWPORT handling a bit more handles, see GH #435 fix mingw -Wpointer-to-int-cast pointer arithmetic update ax_add_fortify_source to 3 check -D_FORTIFY_SOURCE=3 first update to latest m4/ax_valgrind.m4 alive.test already has valgrind support ax_pkg_swig.m4: reapply my mingw fix 2023-01-06 Reini Urban update most autoconf-archive m4's just not my extended m4/ax_compiler_flags_cflags.m4 configure: replace deprecated $as_echo 2023-01-06 Michal Josef Špaček Log LWPOLYLINE flag rurban: Fixed VERTEXIDCOUNT name 2023-01-05 Reini Urban init_sections: another bounds-check error ossfuzz 54237 use spec.h table flags for r11 also Log table flags Replaces PR #562 decode_r11: fix wrong HAS_ELEVATION filter for r10 LINE, POINT, 3DFACE: also catch deleted entities. Fixes GH #558 out_dxf: skip deleted entities explicitly as documented. but still does not work. the LINE in the BLOCK is missing, and the INSERT preR13: log and document deleted entities when type > 127. we rather keep them. processors (like viewers or converters) must filter them out by themselves. add r10/tmp_line test-data by Michal. See GH #558 add r2.10/block test-data by Michal. See GH #483 2023-01-05 Michal Josef Špaček Identify text extrusion Log attrib entity flags rurban: kept comments 2023-01-05 Reini Urban Really fix blocks_end a zero and a size of 0x40000000 denotes an empty BLOCK section 2023-01-05 Michal Josef Špaček Fix blocks_end 2023-01-05 Reini Urban .gitignore: .ccls-cache some emacs thing fixup block flags, use the old names even if is_ref_ref and is_xref_dep are mixed up in the old code. they should be exchanged later 2023-01-05 Michal Josef Špaček Log block flag 2023-01-04 Michal Josef Špaček Identify block options and log them Fix block entity in preR13 Add PRESET flag for attdef entity 2023-01-04 Reini Urban r11: less table offsets the one missing byte in several tables decode_r11: change wrong curve_fit POLYLINE_2D to VERTEX_2D an extra vertex created via pedit L F, but with wrong type. Fixes GH #548 xmlsuite: robust check.py only take test-data/r* or numeric dirs configure: fix libxml-2.0 probe 2023-01-04 Michal Josef Špaček Fix LOG_FLAG_R11_MAX rurban: with adjustments. bitmasks need the sum, not the last Log attdef entity flags preR13: Fix 3DFACE spec Name some dimension options Log 3DLINE opts Fix align of logging 2023-01-04 Reini Urban more FLAG_R11_DIMENSION flags see acad_r12_dxf.pdf log more VERTEX flags keep the existing names, unlike PR #550 more flags, and some simplifications those flags do have the same fieldname. only the prefix may vary for subclasses. 2023-01-03 Reini Urban programs: adjust --help and .1 for saveas version via regen-man classes: require dwg.h bash build-aux/clang-format-all.sh src programs examples test and add some more fixups decode: Better Invalid class size warning cleanup unused r11 opts and flags and warn if an unused appears 2023-01-03 Michal Josef Špaček Fix bigfont_file in style table 2023-01-03 Reini Urban decode_r11: fail on invalid numsections Fixes ossfuzz 50191 preR13 POLYLINE_MESH fixup new opts and DXF 2023-01-03 Michal Josef Špaček Fix polyline mesh entity for preR13 rurban: but still 4 byte too many (TEMP.DWG_from_autocad_r10_r10.log) Add extrusion to polyline entity Add extrusion to line entity Add extrusion to insert entity 2023-01-03 Reini Urban add HORIZ_ALIGNMENT flags and logging more LOG_TEXT_GENERATION and LOG_VERT_ALIGNMENT for all versions 2023-01-03 Michal Josef Špaček Rewrite logging of R11 flags to HAS_ prefix Log vertical alignment rurban: with additions Log polyline flag rurban: with changes Add logging of vertex flag rurban: formatting, r11 types, %d Add logging for text generation rurban: minor changes Add pretty print of entity options rurban: Changed and simplified to R11 types Name unknown flag 2023-01-03 Reini Urban add_test: print dwg/dxf_read error code on fail 2023-01-02 Reini Urban indxf: sync with dwg_set_dataflags wrong dxf logic add dwg_log_dataflags and dwg_set_dataflags set the r2000 TEXT.dataflags when up-converting add dwg_log_proxyflag GH #469 r11: fix POLYLINE_2D.flag Fixes GH #542 2023-01-01 Reini Urban decode_r11: fix ossfuzz 47189 entities_end overflow injson: fix ossfuzz 47352 skip empty entities 2022-12-31 Reini Urban fix dwg_bmp GH #539 fix the dat.size allow huge max_decomp_size with r2004 (eg. material.dwg, Theigha bug?) decode: skip dwg_bmp early when header.thumbnail_address is 0, but there is still an empty thumbnail sentinel block. eg 2000/Multileader.dwg calc TDCREATE from TDUCREATE from the timezone offset. Fixes part of GH #394. I've looked at the DXF values, and there the TDUCREATE value matches the dwg, not TDCREATE. 2022-12-30 Reini Urban fix make codecov for out-of-tree configures decode: fix ossfuzz 54163 overflow when reading handles (e.g. an obj->size MS) from wrong address decode_r11: fix ossfuzz 49721 overflow when reading the UCS section hdr r11: DIMENSION opts flags, and 3d pts Closes GH #468 2022-12-29 Reini Urban r11: 3d DIM points since r10 only when the FLAG_R11_ELEVATION is missing decode_r11: better DIMENSION_RADIUS honor ELEVATION flag for 3D points spec: DIMENSION.flag 70 no flag1, the DXF is the same as the DWG flag preR13 2022-12-28 Reini Urban spec: changed r11 DIMENSION spec GH #468 refactor decode_preR13_DIMENSION 2022-12-27 Reini Urban replace missing R_13 checks with R_13b1 2022-12-26 Reini Urban spec: cleanup unused HEADER vars, regen-dynapi r11 UCS: the last byte is extra it does not belong to the UCS hdr spec: change HEADER USERI1-5 to signed r11: remaining unknown HEADER vars for proper roundtrips. add: more r11 header defaults 2022-12-25 Reini Urban fix preR13-dims flag_r11 logic Fixes GH #468. To be tested with rw -r2.6 and add. r11: write back HANDSEED r11 add HEADER.VPOINT(X,Y,Z)(ALT) the main and alternative VIEW directions 2022-12-20 Reini Urban examples: allow examples/dwgadd_test.sh invocation macOS diff -1 deprecation diff -bu1 interpretated as -b -u -1 -u number is deprecated, use -U See GH #541 2022-12-19 Reini Urban add dwg_init_sections, default_numheader_vars it was too ugly. and wrong. Fixes GH #540 2022-12-17 Reini Urban fixup encode: grow header.sections on dwgadd -Wsign-compare 2022-12-16 Reini Urban encode: grow header.sections on dwgadd on r2004 with the MEASUREMENT section. encode for r2004 is not supported yet, but we can run into this heap overflow. Not explicitly forbidden yet, we just print a Warning. 2022-12-16 Reini Urban replace all R_13 checks with R_13b1 preR13 goes PRE R_13b1 (AC1010) fix 3DFACE spec for R13b1 - R_13: VERSIONS (R_10, R_13) was wrong 2022-12-15 Reini Urban preR13: better wrong dat->chain free fix restore the proper dat on fatal error. Fixes GH #486 decode: protect illegal object_end and underflowing header_vars.size. Also oss-fuzz 54163 decode: Fixup illegal Header Length the extra RL after the header sentinel might be wrong. Fixes heap overflow in oss-fuzz 54163 bits: fix dat->byte mult overflow e.g. with oss-fuzz 54163 spec: start syncing dwg.spec preR13 tables with decode_r11 GH #538 2022-12-15 Reini Urban preR13: fix wrong dat->chain free with preR13 tables and wrong data, leading to an early return. FIELD_VECTOR_INL behaves better, but see GH #538. But LTYPE only table with bit_reset_chain() because of some tbl->size logic later, so we are safe for now. 2022-12-15 Reini Urban dynapi: simplify TV strings 2022-12-15 Michal Josef Špaček Fix DWG versions AC1.3 probably doesn't exist. After this patch version line is full Fix AutoCAD releases Releases based on https://autodesk.blogs.com/between_the_lines/autocad-release-history.html Fix DWG version in header Support MC0.0 DWG file Set dwg_version to 1 as first version of DWG file. 2022-12-14 Reini Urban dynapi: protect fixed TFv strings eg. from fuzzed illegal input. Fixes oss-fuzz #49928 indxf: enforce dxf_fixup_header for missing $ACADVER HEADER is optional, so enforce some version. Needed for string conversions. R_INVALID is invalid 2022-12-14 Reini Urban dxf: fix EED 1004 with empty value need to print the GROUP 1004, even with empty value. Fixes GH #536 DXFB has a better logic: do{} while, and is not affected. 2022-12-14 Reini Urban dxf: NOD must be the first OBJECTS item not just the first DICTIONARY. Fixes part 1 of GH #536 json: fix LTYPE.dashes_r11 size fixed size 12 for json also. Fixes oss-fuzz #53617 json: fix json_cquote for illegal (fuzzed) strings Fixes part of oss-fuzz #53617 decode: fix assert with fuzzed illegal HEADER No Section Locator Records at 0x15 Fixes oss-fuzz #47319 decode: route AC1010 and AC1011 to r13, not preR13 but I dont have any proper samples from those. only fuzzing DWG's 2022-12-13 Reini Urban decode: fix -v4 GH #368 asan crash invalid alloced result in FIELD_HANDLE add make log-dwg target individual log files, not a big check-dwg.log decode_r11: fix reading empty tables and r11 blocks (without 32byte sentinel) add: set HEADER.numsections otherwise we overflow with r11 in header_vars. logic from decode_r11 dwgadd: disable --verify without -o DWG because we cannot read back in from stdout add: set HEADER.numheader_vars free: fix r1.4 leaks of deleted entities encode: name harmonization add: fixup HEADER.numentities via the dwg_add API 2022-12-12 Reini Urban dwgadd: bypass asan leak test for r1.4 encode: fix preR13 entity size add crc encode preR13: no duplicate flag_r11 and size dwgadd: fixup FMT_ANY quirks, final " FMT_ANY %NNNs parses to the next whitespace, keeping the last " add: fix preR13 DIMENSION flags and types add: revert Michals R11 type adds only defined valid R11 types. set them manually add API: preR13 fixups flag_r11 and opts_r11 encode preR13: more unhandled _R11 types Michals r11 type fixes changed our type handling, and set it to _R11. Fix it up for dwgadd decode: fix double-free of XRECORD.objid_handles silly code. Fixes GH #518 encode preR13: fixup size if empty (e.g. dwgadd) 2022-12-12 Reini Urban encode: fix writing r13,r14 bitsize The position os different from r2000, but we can handle it here at the same place, because we patch it at bitsize_pos when missing. Fixes GH #531 2022-12-12 Reini Urban dwgadd: LOG_INFO dwgadd: fix -v options for --verify dwgad: enable r14,r13 tests without XRECORD DICTIONARY.ownerhandle still wrong spec: fix DICTIONARYWDFLT.cloning and remove cloning_r14 dwg_add: fix add_DICTIONARY for the NOD configure: move DEBUG_CLASSES into config.h and use it to test dwgadd (#530) 2022-12-12 Michal Josef Špaček Fix writing of 1.4 release DWG files We are setting entity type for proper version and Fix writing of 1.4 release DWG files We are setting entity type for proper version and unit-tests: fix load field 2022-12-11 Michal Josef Špaček Fix parsing of AutoCAD 1.4 entities num is index of actual object Fixing GH#471 2022-12-09 Reini Urban dwgadd: cleanup old code, fix retval Fixes GH #388 when only one object was added. dwgadd: check dwg_add_dat retval if it failed to add any object. e.g. r11 fails to add one point (GH #388) dwgadd: fix dwg leaks when add fails harmlessly, eg. r11 with one point 2022-12-08 Reini Urban dwgadd: enable more tests just the XRECORD double-free not. r11 errors on verify with 0x100, but not fatally dwgadd: adjust tests encode: fix writing incomplete tables (preR13) eg. as created by dwgadd fix ACSH_init_evalgraph evalexpr leak The evalexpr handles are initialized as global, i.e. created in the object_refs[] vector. Se we can safely free it here. Fixes GH #529 2022-12-08 Reini Urban free: fix header_vars.unknown_text1 leak with dwgadd, resp. dwg_add_Document() fix the FIELD_DD overflows again this time count to the bits. See GH #505 dwgadd: fix dat leaks dwgadd: add more tests and check the verify return value. GH #388 dwgadd: fix dat->size overflows kept old dwgadd file size, did not set the new dwg file size. GH #388 2022-12-06 Reini Urban more fuzzing improve fuzzer documentation. run oss-fuzz on some push also 2022-12-05 Reini Urban dwgadd: use sscanf_s Closes GH #388 dwgadd: forbid >r11 entities with <=r11 gh: use latest actions for node16, node 12 deprecated in summer 2023 dwgadd: add tests dwgadd: set loglevel, parse only once WIP dwgadd: support -a VERSION regen-man, adjust dwgadd.1 dwgadd: support empty -o outfile write to stdout then. change --verbose from -v1 to -v3. 2022-12-01 Dmitry Sinyavin Various fixes to dwgadd GH #388 CLA done 2022-12-01 Reini Urban Update NEWS, AUTHORS. prep 0.13 release bump appveyor tags unit-test: fix r11 leaks on errors as r11 samples still fail. r11 missing sections or section errors now return DWG_ERR_SECTIONNOTFOUND. 2022-12-01 Reini Urban decode_r11: protect from fatal r11 section errors Fixes GH #493 with illegal (fuzzed) input 2022-11-30 Reini Urban decode_r11: fix NULL deref with fuzzed block names Fixes GH #528 2022-11-29 Reini Urban cmake: fix install missing public headers, missing programs executables decode_r11: fix post HEADER overflow fixes ossfuzz: 53750 missing dat chain overflow GH #505 rework PR 508: catch overflows when reading from it, not when merely advancing. One such case is TRACE_DD, which must be fixed there. 2022-11-23 Reini Urban dwglayers: skip empty layer handles Fixes GH #519, fuzzed invalid input decode_r11: failing dwg_get_first_object TABLE_CONTROL Fixed GH #524. decode_r11: implement PRE_TABLE(UCS) dwg_add_UCS accepts now a NULL origin, as needed by r11. decode_r11: better numsections calc. to avoid section[] overflows. 2022-11-20 David Korczynski gh: add CIFuzz integration 2022-11-20 luz paz Fix typos Found via `codespell -q 3 -S ./.git,ChangeLog,./NEWS -L 2rd,aadd,addd,aded,afe,ba,baed,beed,childs,daa,ded,ede,fo,gir,gost,nam,noo,oce,ro,siz,tekst,ue,uptodate` 2022-11-18 Reini Urban decode: fix fuzzing type confusion leading to arbitrary pointer reads. set the obj->type to UNKNOWN_* on unknown class, as the further type switches act on this type. eg out_json. Fixes oss-fuzzer #53468 2022-11-17 Reini Urban fix bit_advance_position buffer overflow error we may advance to the end of the stream. 2022-11-15 Reini Urban dynapi: regen tests without LAYER.flag broken with commit seperate LAYER.flag0 2022-11-14 Reini Urban dwg_decode_add_object comment only indxf: assign missing handles for tables for minimal DXF, GH #474. No entities yet, and still WIP. Also default to R12 as from_version. indxf: resolve table refs earlier when we start reading ENTITIES, after the tables. Fixes a part of GH #474, now only special table entries are missing. (e.g. LTYPE.CONTINUOUS) indxf: fix Invalid VPORT_CONTROL field objid ERROR we can set this object field directly, dynapi cannot. One part of GH #474 cmake library DESTINATION #333 add missing library DESTINATION also. thanks @j3pic 2022-10-16 Reini Urban api: seperate LAYER.flag0 from flag 70 they are completely different bits. See GH #510. fix LAYER.plotflag calculation Fixes GH #509, thanks to @zamtmn (zcad) 2022-09-05 Reini Urban GitHub Workflows security hardening https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs 2022-08-15 Reini Urban cirrus: FreeBSD 13 update to python39 2022-07-31 luz paz Fix various typos Found via `codespell -q 3 -S ChangeLog,./NEWS -L 2rd,aadd,addd,aded,ba,childs,daa,ded,fo,gir,gost,noo,oce,ro,siz,tekst,ue` 2022-07-30 Reini Urban Revert "Fixes Stack-buffer-overflow in dynapi_set_helper" This reverts commit 4e3f073be2453148af5f4da4d5d22ce9e6c2f7a5. Testing if this fixes mingw. 2022-07-29 Reini Urban fixup Fixes Heap-buffer-overflow in dwg_decode_MINSERT_private invalid bit_advance_position fix. we need to advance it, even when out-of-bounds fixup decode_r2007 off-by-one commit fe03c5a89cbd441b6840335bd484cf08bc65c7c4 only set the size for one case, but we had three. Fix the real problem, the dest overflow check. unit-testing: enable preR13 DWGs preR13: fix --disable-write cannot decode_r11 without dwg_add_* Fixes GH #498 2022-07-29 Aleks L <93376818+sashashura@users.noreply.github.com> Fixes Stack-buffer-overflow in decompress_rNUMBER https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44432 `sizeof (r2007_file_header) + 1` is passed in `read_file_header` which leads to off by one write buffer overflow. 2022-07-29 Aleks L <93376818+sashashura@users.noreply.github.com> Fixes Heap-buffer-overflow in dwg_decode_MINSERT_private https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31741 and https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31591 The out of bounds read happens in `TRACE_DD` macro at `dat->chain[dat->byte]` because of corrupted `dat->byte`: `dat->byte` equals to `dat->size`. The corruption happens before in `bit_advance_position`. When `advance == 2`, `dat->size == 2`, `dat->byte == 1`, `dat->bit == 6` it calculates `pos == 14` and `endpos == 16`. Then it passes the overflow check: `if (pos + advance > endpos)` and after ```cpp dat->byte += (bits >> 3); dat->bit = bits & 7; ``` `dat->byte` becomes 2. 2022-07-29 Aleks L <93376818+sashashura@users.noreply.github.com> Fixes Segv on unknown address in dwg_free_summaryinfo https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33059 `dwg.summaryinfo.props[0].value` in `dwg_free_summaryinfo` is uninitialized pointer. It happens when `dwg_read_dxf` fails and partially initialized summary info object is created. 2022-07-28 Reini Urban api: fix dwg_dynapi_handle_name 3rd arg esp. needed for the unit-tests decode: set dirty_refs in dwg_decode_add_object_ref See GH #495 preR13: fixup the new unknowns for r11 and r2.* regen-dynapi 2022-07-28 Michal Josef Špaček Fix POLYLINE detection in preR13 Fix VERTEX detection in preR13 Fix r11_unknown on multiple tables Fix VIEW table for preR_10 2022-07-28 Reini Urban SKIP and TODO failing r11 tests for now but start smoking them. 2022-07-28 Michal Josef Špaček Fix layer linetype index in preR13 Fix STYLE for text entity Fix style in ATTRIB entity Fix style in ATTDEF entity 2022-07-28 Reini Urban preR13: set control object handles continuation otherwise the entries handles would start at 0 again encode r11: check table types errors cuased by wrong ctrl->entries handles/indices injson: r13 -> r13b1 free: fix double-free of DIMSTYLE.DIMTXSTY esp. preR13, which has no handle.is_global preR13: en/decode the 5 new r10-r11 table headers which are embedded in the header section. also add the CONTROL objects with add_Document. header.numsections is wrong. should be header.numoldtables or such. encode r11: trace tables encode r11: write crc16 and r11_sentinel dwgrewrite: improve usage, allow more versions dwgrewrite: fix dwg_variable_dict dirty static var_dict !var_dict is not enough to check for a valid ref. Fixes invalid var_dict->obj WIP dynapi: TFv exceptions the reader needs large enough buffers 2022-07-28 Reini Urban improve dwg_ref_tblname return status if a fresh allocated or static string. Fixes dwgrewrite and dwggrep heap-use-after-free crashes, but not yet the dwg_find_dicthandle crash with LIGHT. make regen-dynapi 2022-07-28 Reini Urban rename FLAG_R11_HAS_ATTRIBUTES => FLAG_R11_HAS_ATTRIBS for consistency 2022-07-28 Michal Josef Špaček Identify has_attributes flag Use of R11FLAG with named constant 2022-07-28 Reini Urban json: avoid heap-buffer-overflow for fixed json strings TFv, TFF and such. Luckily only for preR13 strings preR13: convert CONTROL objects back to tables on encode. flags not, but they look fixed UNKNOWN_UNTIL reading only with decode add r2.6 dim dwgs by Michal 2022-07-28 Michal Josef Špaček Fix preR13 shape entity Fix linetype 2022-07-28 Reini Urban decode: improve CLASS logging LOG_POS always added a \n. but do that dependent on the trace level. decode: trace object vector REALLOCs improve decode EED logging LOG_POS add a \n, avoid duplicate \n free: fix one-byte leaks with empty TU handle names preR13: fix ref->obj crashes resolve_objectrefs when dirty. fixes the dwg2dxf crashes. preR13: more SHAPE fields (untested) 2022-07-28 Michal Josef Špaček Fix shape entity handle 2022-07-28 Reini Urban preR13: log the flag_r11 bits r11: pspace and viewports but viewports not fully yet dwgrewrite beauty add preR13 handle support if the HANDLING header_var is set (ie some opts_r11 flag), we have special r11 handles. extend VALUE_H for this. preR13: more work on dimension opts preR13: abstract and use UNKNOWN_UNTIL(pos) for the unknown ranges, esp. in the header_vars_r11 2022-07-28 Reini Urban preR13: fix ltype sizes r11: 2 before: 1 also linewt is shorter pre-R11 2022-07-28 Reini Urban decode: fix revised dwg->object realloc strategy we have now a global dwg->num_alloced_objects. fixes heap-buffer-overflow with preR13 preR13: common_entity_data.spec and harmonize ent to _ent fields. preR13: fix DIMENSION type switch and improve the fields a bit preR13: handling_r11, dwg->block_control, POLYLINE types support 2 more POLYLINE types. breaks the r11 tests now preR13: fix POLYLINE_PFACE 2022-07-28 Michal Josef Špaček preR13: Fix entities and block entities decoding PR #452 2022-07-28 Reini Urban r11: log unknowns 2022-07-28 Aleks L <93376818+sashashura@users.noreply.github.com> Fixes Heap-use-after-free in dwg_free_TABLEGEOMETRY_private https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46847 The title is somewhat misleading, because it is a read out of bounds, but the memory out of the bounds is previously allocated and then freed, so it says use after free. In `add_TABLEGEOMETRY_Cell` function when `o->num_cells` equals to zero, the call to calloc doesn't return NULL because of https://linux.die.net/man/3/calloc#:~:text=If%20nmemb%20or%20size%20is%200%2C%20then%20calloc()%20returns%20either%20NULL%2C%20or%20a%20unique%20pointer%20value%20that%20can%20later%20be%20successfully%20passed%20to%20free(). So it passes the check ```cpp if (!o->cells) { o->num_cells = 0; return NULL; } ``` Next it goes to `switch (pair->code)` which is 10. So it fails the `CHECK` because `i == -1` and return NULL, however the `o->cells` has the the address from zeor size calloc call. ```cpp #define CHK_cells \ if (i < 0 || i >= (int)num_cells || !o->cells) \ return NULL; \ ``` Later in `dwg_free_TABLEGEOMETRY_private` an offset of `tablegeometry` is added to the address in `o->cells` so it reasult in heap read overflow. 2022-07-28 Aleks L <93376818+sashashura@users.noreply.github.com> Fixes Stack-buffer-overflow in dynapi_set_helper https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46918 `dwg_dynapi_header_set_value` in `json_HEADER` is called with a pointer to long: ```cpp long num = json_long (dat, tokens); LOG_TRACE ("%s: %ld [%s]\n", key, num, f->type) dwg_dynapi_header_set_value (dwg, key, &num, 0); ``` However the `f->size` is 255 which leads to stack overlow in `dynapi_set_helper` when `memcpy (old, value, f->size)` is called. 2022-06-27 luz paz Fix various typos Found via `codespell -q 3 -S ChangeLog -L 2rd,ba,childs,daa,ded,fo,oce,ro,siz` 2022-06-26 Michal Josef Špaček Add case with --disable-write There is issue with build actually in this special case. 2022-05-16 Reini Urban make distcheck: package the new files 2022-05-14 Michal Josef Špaček Add test files for R11 2022-05-09 Reini Urban codeql: yaml syntax fixes paths must be in an extra codeql-config.yml file, as argument to init@v1 2022-05-08 Reini Urban json: support RSd, eg for TABLE.used fields and skip duplicates 2022-05-08 Reini Urban codeql UB: pointer overflow check When checking for integer overflow, you may often write tests like p + i < p. This works fine if p and i are unsigned integers, since any overflow in the addition will cause the value to simply "wrap around." However, using this pattern when p is a pointer is problematic because pointer overflow has undefined behavior according to the C and C++ standards. If the addition overflows and has an undefined result, the comparison will likewise be undefined; it may produce an unintended result, or may be deleted entirely by an optimizing compiler. fixes codeql #51, #52 2022-05-08 Reini Urban codeql: integer-multiplication-cast-to-long Multiplication result converted to larger type with possible arithmetic overflow. codeql #2, #3, #5 2022-05-08 Reini Urban CodeQL #53, compare long with narrow Comparison of narrow type with wide type in loop condition In a loop condition, comparison of a value of a narrow type with a value of a wide type may result in unexpected behavior if the wider value is sufficiently large (or small). This is because the narrower value may overflow. This can lead to an infinite loop. 2022-05-08 Reini Urban extend CodeQL #65, decode int overflow Extend aca2aead798c300f4fa40a7a85c49564a6408c82 preR13: fix TEXT.common.ltype leak and exports dwg_api: fix preR13 vertex iterators fixed preR13 types dwg2ps and the old object check was also wrong. r11: change dashes_r11 to static [12] inlined 2022-05-07 Reini Urban r11: fix LTYPE dashes and STYLE 2022-05-06 Reini Urban security: no alloca in a loop CodeQL #50. looped num_eed or num_classes times for all strings. rather recycle the temp. stack buffer. get rid of alloca at all. 2022-05-06 Reini Urban Merge branch 'smoke/preR13-iterators' GH #453 Create interim _CONTROL objects, holding the tables. best as r2004 arrays, not as r2000 doubly-linked lists. this would allow the old iteration via model_space -> block_control -> entities, as before. e.g. for dxf in/out, and all the helpers. There are still minor leaks to be fixed, and DXF to be tested. 2022-05-06 Reini Urban load_dwg: preR13 fixes with wrong types injson: more leaks preR13: allow dxfwrite memory leaks for now. GH #466 preR13: harmonize color_r11 into color CMC and fix injson warning: gnore wrong index i, expected i-2 clean: extend make clean to new tests make distcheck failed with distcleancheck 2022-05-05 Michal Josef Špaček Fix R11 header sentinel There are multiple R11 header variants (204 and 205 header variables) 2022-05-05 Reini Urban injson: fix 2dpoint import into 3dpoints json: fix r2-r11 json for INSERT 2022-05-05 Reini Urban injson: don't Change wrong type to fixedtype for old preR13 dwg's. alive.test: abstract clean() function 2022-05-05 Reini Urban preR13: fix heap-over-flow with fixed TF strings strdup of such a TF shortens it, and runs into a heap-over-flow on bit_write_TF. r11: fix outdxf ENDBLK leaks r11: add crc16 and DWG_SENTINEL_R11_HEADER_END check Revises PR #458 r11: read table crc16 revises previous commit 2022-05-05 Michal Josef Špaček Fix trailing bytes for table check 2022-05-05 Reini Urban autoupdate to autoconf 2.71 but still try to be back-compat with autoconf-2.69 decode: fix int overflow CodeQL #65: Multiplication result may overflow 'unsigned int' before it is converted to 'long'. CodeQL: restrict to sources, skip scanning unsafe test code preR13: add enum DWG_OBJECT_TYPE_R11, fix mspace BLOCK do not encode the artificial mspace BLOCK and ENDBLK, set its type to 0. return a proper dwg_add_BLOCK_HEADER result. preR13: split too large json_header_write_private functions variable tracking size limit exceeded with ‘-fvar-tracking-assignments’ free: fix block_control->entries leak we allocated entries for model_space, and removed num_entries distcheck: ship the new preR13 test-data Fixes make distcheck preR13: fix leaks in common_entity preR13: add dwg_free_preR13_header_vars to match decode. Fixed all leaks. API: change dwg_add_Document, add dwg_new_Document else preR13 leaks the dwg. Down to 79 byte(s) leaked. preR13: set new dwg from add_Document and free the add_Document defaults when decoding it preR13: fix some table name leaks dwg_add_TABLE creates a new name. from 10304 leaking bytes down to 6456 with r11/ACEB10. indxf: fix missing AcDbZombieObject subclass fixes example_r13 alive.test tests: enable example_r13 and fix a proxy_object unit-test with a NULL objid preR13: more json and encode tables with encode from json/dxf we don't have sections, just the control objects. preR13: block_header and style specs esp. for r11 preR13: fix encode handle sizes fixes dwgrewrite preR13: fix unit-testing/decode_test undefined refs preR13: decode tables into objects set the entries handles, common fields preR13 json: set ctrl table fields size, num_entries, entries preR13 json: add object handles and r11_idx preR13 docs: Add Tables How the old tables are mapped into the new objects preR13 refactor: extra decode_r11.c module and add all the CONTROL objects for the tables. conveniently use dwg_add_Document for the initial setup, so that we can treat r11 similar to r2004 iterators. i.e. GH #443 Variant 2 rename HEADER.num_entities and .num_bytes to .numentities and .dwg_size, not to be skipped in json 2022-05-05 Reini Urban WIP preR13: partial tbl support for in_json create the sections from the objects, but just the number. the size and address should be filled on encode Two variants: 1. json dump the tables, entities and blocks, as in the dwg/dxf. very simple, but special code for in_json. 2. or create interim _CONTROL objects, holding the tables. this would allow iteration via model_space -> block_control -> entities, as before. e.g. for dxf in/out, and the helpers. 2022-05-05 Reini Urban preR13: rename the magic FILEHEADER.numheader_vars, numsections They are not exported to json, because the num_ fields are just the number of the related array. But here we have no related array, at least not trivially. Rather store them in json, so rename them. preR13: fix api impl. type => fixedtype needed esp. in the iterators. now the tests dont hang, just fail for injson and dxf preR13: activate alive.test, fix dwggrep a bit dwggrep and dxf would need the BLOCK_HEADER/BLOCK_CONTROL objects for basic entity/blocks iterators. injson and dxf still broken. 2022-05-05 Michal Josef Špaček Fix 3dline entity 2022-05-03 Michal Josef Špaček Fix 114 header variables Fix WORLDVIEW header variable 2022-05-03 Reini Urban add SECURITY.md github complained about it make regen-dynapi: VIEWDIR DXF 2022-05-03 Michal Josef Špaček Fix preR13 layer index in entities 2022-05-01 Reini Urban fixup r2.10 dxf header_vars codes for TEXTSTYLE, CLAYER. Don't change the normal codes, just r2.10 is flipped 2022-04-30 Reini Urban fixed r2.10 dxf header_vars could not test the versions between r2.10-r2.6, so this needs to be adjusted later. I assumed r2.21 preR13: work on dxf support fixed all the header vars so far. doc: Update pre-R13 capabilities list all supported revisions. add @registeredsymbol. add trademark paragraph. dwgadd: fix --disable-dxf compilation move api functions to dwg_api.c with --enable-write --disable-dxf --disable-json. Fixes GH #449 2022-04-30 Michal Josef Špaček Fix preR13 line entity Fix preR13 3DFACE entity 2022-04-28 Michal Josef Špaček Add AC1006 test DWG file 2022-04-26 Reini Urban preR13: support deleted entities r2.0-r11 which are the entities moved into a BLOCK. eg test-data/r2.10/entities.dwg and r2.6, but also r1.4. preR13: fix POLYLINE_2D.end_width The other PR #448 fixes do look wrong to me 2022-04-26 Michal Josef Špaček Fix style_id print in shape entity 2022-04-26 Reini Urban preR13: support block entities with no block_end, only num_entities in the loop. the blocks_offset is really the size minus 0x40000000, as Michal said. he was right. rename it. Now just the VIEW is wrong. Fixes GH #444 2022-04-25 Reini Urban gitignore preR13 docs preR13: fix SHAPE specs style_id and scale mostly. replaces PR #445 2022-04-24 Michal Josef Špaček Fix begin block entity There is no block name in this entity. Block name from pre R_2_0 is converted to block table. Fix preR13 ATTRIB entity Fix preR13 attdef entity options Fix ATTDEF flags comment Add AC1003 test DWG file With script definition Add AC2.10 test DWG file With script definition 2022-04-24 Reini Urban encode: fix table object indices to write but still fails 2022-04-23 Reini Urban decode TF, less verbose tracing outjson: adapt to preR13 and prepare the tests. no subdirs dwgs yet encode: fixed for r1.4 tested ok with dwgrewrite, but no translations yet from other versions. json and dxf also not yet adapted. preR13: enable write of preR13 in programs enable decode_preR13 even in releases doc: fix recursive TEXINPUTS Fixes GH #404. Thanks to @AndrewAmmerlaan 2022-04-22 Reini Urban install: fix load_dwg.py destdir Fixes GH #406 preR2: fix r1.4, change ENDREP fields ENDREP harmonized with MINSERT. re-enable r1.4 unit-test for load spec: fix shape spec for r13 broken with 8f116dd9b79b587f163cb0bfafc33b49a8d503db disable r1.4 decoding in unit-test not yet stable preR13: fixes for old types use fixedtype for encode: fix patching preR13 pos more LOAD support, make regen-dynapi dxf, json, unit-test 2022-04-21 Michal Josef Špaček Fix pre R_2_0 shape entity Fix pre R_2_0 text entity Fix pre R_2_0 common entity reading There is no entity size. There is flag_r11 and flag2_r11 fields, but zeroed still Add load entity This entity is pre R_2_0 Fix preR13 PSLTSCALE and TREEDEPTH header variables 2022-04-21 Reini Urban rename test-data/1_4 to 1.4 2022-04-21 Michal Josef Špaček Add AC1.40 test DWG file 2022-04-21 Reini Urban Merge branch 'smoke/versions' into smoke/preR13 Use a proper table and an API. E.g. support beta versions, diffing only in the dwg_version. indxf: same here but also set dwg_version from the struct in_json: use the new dwg_version_hdr_type() and not linear search topdown. also revise the version on dwg_version (if a beta). 2022-04-21 Reini Urban refactor DWG versions (GH #436) enable all the known alpha and beta versions, seperate pre and post release versions, add api to check the dwg_version with the magic header, change linear search backwards, so that we can list the versions chronologically. Fixes GH #436 also adapt pre r2.0 changes to encode. 2022-04-21 Reini Urban WIP preR13: fix BLOCK_HEADER tables 2022-04-20 Reini Urban preR13: fix r9 header_vars missing num_entities and unknown_5. partially support POLYLINE, type 18, but this has different flags. encode: better FIELD_CAST tracing e.g. BLd indent only preR13: first r1.4 attempts 2022-04-19 Michal Josef Špaček Stub for entity handling id Remove extrusion from point I don't think that extrusion is possible in point entity (tested on r14) Fix enums for FLAG and OPTS Fix elevation Fix decoding of entity with thickness thickness is common structure defined by flag before main entity 2022-04-19 Reini Urban preR13: free the dispatched VERTEX and POLYLINE ents dynapi: fix regen-dynapi in-tree as reported by Michal 2022-04-18 Reini Urban preR11: revise current_color_convert not a RD. rather the old smaller CMC struct, with only the low part interesting as index. mingw: appveyor native mingw host=x86_64-pc-mingw64 mingw: disable shared mingw decode_test.exe duplicate symbols on linking 2022-04-18 Michal Josef Špaček Fix current_color_convert and identify TREEDEPTH 2022-04-18 Reini Urban preR13: ltype is only one byte max 255 linetypes. ATTDEF.flags ditto preR13: fail with wrong entity preR13, entity repair, dimensions and fix POINT.z flag preR13: fix LINE opts matching michal's kaitai scripts 2022-04-18 Reini Urban preR13: dispatch VERTEX and POLYLINE use our types. but some opts are still unclear. dxf.test: relax roundtrip check from == to >= 2022-04-18 Reini Urban preR13: more _r11 indices replaced by handles TEXTSTYLE, CLAYER. Fixed some unit-tests 2022-04-17 Reini Urban preR13: fix ATTDEF preR13: harmonize _r11 indices with handles remove the special _r11 indices, and store them in our handles. this way we can convert them easier, name <-> idx <-> handle mingw: more exports spec: remove outdated comment we already handle the nolinks logic. this comment was added with the code in 2010. mingw: use -DDLL_EXPORT no extra LDFLAGS -fstack-protector on windows, link already includes CFLAGS. update TODO plans. fixup some missing EXPORT's. make dwg_version_hdr_type public API 2022-04-16 Reini Urban preR13: harmonize more _r11 fields rename color_rs/ltype_rs to _r11 preR13: ATTRIB fixes and no handles at all preR13: fix INSERT.rotation and set has_attribs preR13: disable pre-R12 EED this code is probably wrong. I got it from dwg11.c have to read when EED's were introduced. preR13: fix TV BS, special-case free by fixedtype not type preR13: more entities and fixed the blocks detection via some temp. hack. still wrong free on wrong types mingw: missing C99 strftime %F %T the msvcrt 2022-04-15 Reini Urban preR13: decode and encode many entities now the _ent->opts_r11 and flag2_r11 are unclear yet. TIMERLL: add support for relative times where date.days == 0 TIMERLL: re-implement proper time conversion from my old dwg11.c (1995), mandates now -lm. use TIMERLL in _r11. 2022-04-14 Reini Urban spec: Identify new pre R13 header variables 2022-04-14 Reini Urban Add missing pre r13 entities Improve entity id comments Comments are in form (number1/number2) or (number1) or (number1/Tnumber3). number1 is entity id after r13 number2 is entity id in r2.0-r13 number3 is table id in r2.0-r13 (there are 5 basic tables and other tables are in header variables). 2022-04-13 Reini Urban work on preR13 header and entities can parse now the entities. cross-checked with Michals dwg*./ksy files from his perl cad modules add DEBUG ents: BREAKDATA, BREAKPOINTREF, *GRIPENTITY with not many fields for now. but I found coverage in free cadforum.cz samples, and latest ODA 23.2 knows it also. 2022-04-12 Reini Urban spec: add 25 UNKNOWN SECTION, improve auxheader.spec document the beta dwg_version fields work on ACAC103-4 support There's only a single example dwg though, and this might be from a beta revision. simplify dwg versions use a single array of releases, headers, versions. and add all the possible DWG versions (also the not yet seen, and the versions which did not change the DWG). 2022-04-11 Reini Urban Fix wrong ERROR: Skip section AcDb:AcDsPrototype_1b The size overflow error was incorrect, fixes one example from GH #144, esp. CFI - RIC - Room v3-2.dwg 2022-04-08 Reini Urban header.spec: document HEADER.security_type flags and regen-dynapi 2022-04-03 Reini Urban fix !HAVE_STRNLEN macro Fixes GH #418 revert part of config.h.in: HAVE_DLFCN_H needed by mingw removed 4 commits before: b087dabf6 extend cmake probes 2022-03-24 Reini Urban indxf: fix use-after-free in the pair error-return design E.g. GH #425. On errors don't free pair and use pair. pair = NULL announces success, on error return the pair. add a EXPECT_UINT_DXF check esp. for BL. signed BL values have the type BLd. 2022-03-08 Reini Urban fix picat out-of-src, document svg11-relaxng install 2022-03-05 Reini Urban gh actions: add mingw-cmake smoker checkout submodules 2022-03-04 Reini Urban extend cmake probes for completeness sake 2022-03-04 Michal Josef Špaček Add some AC2.10 .. AC1009 variables 2022-03-04 Reini Urban improve dwg_add_XRECORD_handle As found out in GH #419, memcpy copied into the wrong part of the union, and overly clever compilers might copy only 8, not >20 bytes. 2022-03-04 Neil Wakefield Fix #422 - Missing functions in CMake/MinGW - Correctly set HAVE_* #defines in configuration step so that fallback options are used when these functions are not available. Fix #421 - BUILD_SHARED_LIBS not respected on WIN32 - Reorder CMakeLists such that BUILD_SHARED_LIBS is set before running configure step - Use #cmakedefine so that ENABLE_SHARED is unset when BUILD_SHARED_LIBS is OFF Fix #420 - HAVE_ALLOCA_H and HAVE_LIBGEN_H symbols ignore results of cmake configure 2022-03-01 Reini Urban configure: remove outdated comment 2022-02-19 Reini Urban fix CirrusCI: git was missing from FreeBSD 13.0 regen-dynapi for header_vars 2022-02-19 Michal Josef Špaček Decode variables in AC1.50 These variables are valid from AC1.50 to AC1009 2022-02-19 Reini Urban no out_dxf with --disable-dxf fix --disable-write cfg preR13 spec: resolve unknown_s[] by Michal GH #412. CodeQL with submodules fix wrong DWG too small error Michal sent an empty 1095 byte DWG r2.10 Fixes GH #411 2022-02-18 Reini Urban Update codeql-analysis.yml 2022-02-17 Reini Urban Merge branch 'michal-josef-spacek-osmode' Merge branch 'master' into osmode Remove .travis Merge branch 'master' into osmode Add codeql-analysis.yml from the wizard 2022-02-17 Michal Josef Špaček GH#409: Fix OSMODE header variable From AC1.50 to AC1009 (old format) there is issue in place of OSMODE variable. BTW: FIELD_RS (unknown_12, 8); is TEXTSTYLE, but this is for another issue, we have second TEXTSTYLE variable for different DWG format. Values: osnap_modes: 0: none 1: endpoint 2: midpoint 4: center 8: node 16: quadrant 32: intersection 64: insertion 128: perpendicular 256: tangent 512: nearest 2022-02-16 Reini Urban spec: fixup PLINEGEN preR11 Fixes GH #408 gcc -Wstringop-truncation bug #88780 abstract the sizes to give gcc a chance. regen-dynapi for AXISMODE 2022-02-14 Michal Josef Špaček Remove obsolete comment From `git show 5fa6e0374` ... - decode_preR13_table("BLOCK", ++tbl_id, dat, dwg); - decode_preR13_table("LAYER", ++tbl_id, dat, dwg); - decode_preR13_table("STYLE", ++tbl_id, dat, dwg); - tbl_id++; // skip one - decode_preR13_table("LTYPE", ++tbl_id, dat, dwg); - decode_preR13_table("VIEW", ++tbl_id, dat, dwg); + decode_preR13_section_ptr("BLOCK", SECTION_BLOCK, dat, dwg); + decode_preR13_section_ptr("LAYER", SECTION_LAYER, dat, dwg); + decode_preR13_section_ptr("STYLE", SECTION_STYLE, dat, dwg); + // skip one + decode_preR13_section_ptr("LTYPE", SECTION_LTYPE, dat, dwg); + decode_preR13_section_ptr("VIEW", SECTION_VIEW, dat, dwg); ... 2022-02-13 Michal Josef Špaček Add AXISMODE and AXISUNIT 2022-02-06 Reini Urban Release 0.12.5 add a github release action helper smoke also pull requests and tags (for the release) avoid UNKNOWN.tar.gz on --depth 1 checkouts 2022-02-06 Reini Urban dwg_next_entity: fix immediate cycles but we cannot yet detect non-immediate cycles, as from illegal, fuzzed DWGs. See GH #345 bmp: better bounds-checks for wrong header_size Fixes fuzzed GH #354 (Illegal DWG bmp preview) encode: bounds-check remove_NOD_item with illegal DWGs. Fixes GH #357 encode: protect from invalid ACDBPLACEHOLDER class_id Fixes GH #359, a fuzzed DWG with ACDBPLACEHOLDER as 53 (STYLE) encode: work on GH #364, #361 and #360 but no idea yet, how the hdl_dat stream overflows here. all 3 cases the same problem in overlarge PLANESURFACE hdl_dat. 2022-02-05 Reini Urban indxf: more type protections in dxf_tables_read for illegal/fuzzed input. Fixes GH #366 dxf: protect from wrong style type in SHAPE from fuzzed DWGs. Fixes GH #373 indxf: fix double-free of LAYER.color.book_name Fixes GH #383 fix free: -Wfree-nonheap-object of static arrays dwg2SVG: null-deref GH #390 2022-02-04 Reini Urban decode_r2007: format nits spec: face_modifier, BS cast for DXF Fixes GH #396 warning disarm cirrus FreeBSD smoker, no idea why it fails the tests. fix decode_r2007 off-by-one dst buffer-overflow We have one more byte to write to. Detected only by fuzzing, Fixes GH #391 and #392 by @s1vona outjson: fix JSON_END_REPEAT on early exit several unstable objects need to exit a REPEAT BLOCK on errors. fix that for json, e.g. with FIELD.ChildValue. Fixes GH #397 cleanup dwgwrite AFL left-overs there is now a seperate main() for faster AFL fuzzing 2022-02-01 Reini Urban injson: protect from empty strings No NULL deref. Fixes oss-fuzz #36901, with json of '{}"AcDs"{"segments"[{"name"}]}(' 2022-01-31 Reini Urban appveyor: update mingw deps as on github dxf: improve convert_SAB_to_SAT1 for illegal DWGs. Fixes oss-fuzz #36728 spec: set LEADER.box_width DXF 41 needed for add_test LEADER dxf fixes indxf for LEADER. 2022-01-31 Reini Urban indxf: stricter dxf import 2/3DPOINT* import only from matching DXF codes, not just some irrelevant. special-case clip_verts pairs (WIPEOUT, SPATIAL_FILTER, ...) when the num_ value is set, do the vector alloc. Fixes oss-fuzz #39025 with WIPEOUT.clip_verts indxf now fails on unstable classes, where all DXF groups are known. 2022-01-31 Reini Urban indxf: fix common entity handles don't mixup LWPOLYLINE points 390 with Entity plotstyle handle. also do material and visualstyle handles (the last one only partially) Fixes oss-fuzz #39025 with WIPEOUT.clip_verts 2022-01-30 Reini Urban in_json: invalid HANDLEs here we can have invalid user-input, dont assert. Fixes oss-fuzz #39755 macos ci: enforce newer texinfo see https://github.com/abo-abo/swiper/issues/457#issuecomment-203689787 also update mingw recipe (no autoreconf) spec: fix 2 auxheader type warnings RS -> RL support --disable-json and --disable-dxf in the various helpers. Actually needed for practical compilation times encode: enforce limit of max obj->size to avoid DDOS attacks. Fixes oss-fuzz #41021 We let the overlarge obj->size through, but we just need to skip it. 2022-01-29 Reini Urban dxf_fixup_string: optimize remove dead code. this fixes a valgrind error on dwg2dxf example_2004.dwg Update cirrus freebsd to 13.0 with updated python 3.8 2021-10-11 Reinhard Urban -Wstringop-truncation with clang 2021-10-06 Reini Urban update for latest shellcheck which came with new warnings 2021-10-06 Reinhard Urban mingw: fix github msys/mingw This is msys, so check for ld, which is probed for. 2021-10-05 Reinhard Urban spec: fix dwgadd.example path mingw: attempt to fix github msys/mingw action on msys the compiler is just named gcc, without prefix. but LD is searched for and thus has the mingw path prefix. so msys, mingw cross and mingw works now again. 2021-10-03 Reini Urban fix dictionarywdflt unit-test cloning_r14 is RL there fix -Wstring-concatenation detected by clang Fix handle sizes calc. and encode under Windows GH #346 Handle corruption. Take the size of ulong, not a ptr. Tested round-trips manually. Fixes GH #346 2021-09-30 Reini Urban mingw64 cleanups fix wrong mingw-w64 check with _FORTIFY_SOURCE to add -lssp no double -lm in examples 2021-08-22 Reini Urban simplify alive.test on windows make test sets .exe in PROGS correctly, but not standalone 2021-07-07 huhexiang dwgread: fix r2004_file_header crc32 calculation error 2021-07-06 Reini Urban bit_chain_alloc: add blocks in page size 2021-06-28 Reini Urban add bit_chain_alloc_size to allocate more than 1024 bytes in one swoop. we could use while, but this is better. needed eg for dwgrewrite, GH #364 2021-06-27 Reini Urban indxf: fix setting 10 to y (dxf+10, when dxf = 0) e.g. ASSOC2DCONSTRAINTGROUP.workplane[3] with code 10. Fixes GH #365, fuzzing only indxf: gracefully handle DXF EOF inside CMC Fixes GH #367, fuzzing only convert_SAB_to_SAT1: check more invalid SAB overflows with tag 14 subident also. Fixes GH #368, fuzzing only. dwg_handle_name: protect from strdup(NULL) Fixes GH #369 spec: fix wrong VALUEPARAM allocation values[] are inlined, not per pointer. Detected by GH #370 bit_eq_T: handle null args fixes GH #371 2021-06-26 Reini Urban spec: protect from less LWPOLYLINE widths than points on outdxf with illegal DWGs. Fuzzing only. Fixes GH #372 indxf: one less dxf pair leak the last one indxf: check !pair in add_PERSUBENTMGR Fixes fuzzing GH #376 spec: re-arrange MLEADER union fields a bit so that wrong types from illegal DXF don't corrupt handles. txt vs blk. They are now much better aligned. Fixes GH #378 indxf: protect from overlarge counts fail with invalid dxf when xcalloc fails. fixes fuzzing GH #379 2021-06-24 Reini Urban indxf: missed a CHK_segs in add_HATCH fixes GH #380, fuzzing only indxf: abort on too many MULTILEADER groups 47 Fixes GH #381, fuzzing only 2021-06-21 Reini Urban auxheader: wrong maint_version_* fields and types cast the types to silence warnings. fill both alt. variants of maint_version acds: wrong AcDs.segments.signature type macOS: require python 3.8 for gh actions but python 3.8 on macOS has a wrong linker cfg, -Wl,-stack_size is illegal for shared libs. 2021-06-20 Reini Urban indxf: fix fuzzing overflow with illegal subclasses disallow illegal subclasses, even with non-stable objects. Fixes GH #385. Can only appear with fuzzed input dxf: fix SAB_to_SAT1 overflow GH #384 with fuzzed input data. wrong size check for ltoa conversion 2021-06-16 Reini Urban decode_r2007: more fixes for invalid section size Fixes GH #348. Check memcpy also with uncompressed pages. Fuzzing (illegal DWG's) only. 2021-06-16 Reinhard Urban spec fixups deleting /usr/share/man/man1/dwg* is not recommended. we dont reserve that namespace for us alone 2021-06-16 Tadej Janež Refactor Spec file for building RPM packages 2021-06-07 Reini Urban decode_r2007: fix for invalid section size See GH #350. With fuzzing section->data_size might not fit section_page->uncomp_size. dwgread: fix --disable-write --disable-dxf build dwg_section_wtype: fix fuzzing overflow with illegal and overlong section names. Fixes GH #349, #352 section names cannot be longer than 24 2021-05-15 Reini Urban appveyor: revise fef6deb79 add -lssp to mingw add -lssp explicitly, but someone (libtool?) strips it nevertheless. enforce -fstack-protector on appveyor. need our git. 2021-05-12 Reini Urban decode: non fatal illegal/unknown class esp. with the case of Warning: Recover invalid offset the object is often illegal. Fixes the GH #338 regression. decode: r2013 has larger max_decomp_size for AppInfoHistory and SummaryInfo. See GH #338 decode: improve performance for big DWG's double the size of allocated objects per cycle, not linear by 128. dramatically improves dwg decode performance for big DWG's. 2021-05-01 Reini Urban indxf: more NULL _ctrl->entries derefs e.g. oss-fuzz issue 33447 2021-04-25 Reini Urban Disable broken compiler optimizations See https://lore.kernel.org/lkml/CAHk-=wi_KeD1M-_-_SU_H92vJ-yNkDnAGhAS=RR1yNNGWKW+aA@mail.gmail.com/ fix mingw release: add missing dwgfilter and the pcre dlls See GH #337 2021-04-18 Reini Urban configure: test syntax error (AM HAVE_CYGWIN) add -lssp to mingw started failing again, with only -fstack-protector and only on appveyor. mingw with gh actions not. configure: fix HAVE_ASAN_OR_LINUX AM_CONDITIONAL needed for examples/Makefile.am configure: invalid test -z args Fix mingw %zu warnings 2021-04-17 Reini Urban hardcode codecov_io.sh due to its recent breakin upstream 2021-04-09 Reini Urban cmake warnings target redwg has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION install TARGETS given no LIBRARY DESTINATION for shared library target See GH #333 2021-04-08 Reini Urban dwg2SVG: flush stdout interestingly the libc does not flush stdout to pipes on process exit??? dwg2SVG: improve ELLIPSE absolute rx and ry radii, rotation is the sm_axis (normal vector). Fixes GH #328 2021-04-08 Reini Urban build asan fuzzers only on request fixes failing cygwin smokes. we could install asan on the smokers, but we dont need it. only build it when requested. This needs no oss-fuzz build changes. See GH #330 2021-04-08 Reini Urban Fix configure bashism No string indexing in POSIX sh, for the new GPERF_VERSION check. Broken with 0.12.4 Fixes GH #329 Thanks to Alexey Dokuchaev 2021-04-06 Reini Urban Release 0.12.4 See NEWS Mostly fuzzing patches only. dxf.test: honor --enable-release indxf: calloc NULL strings only if no code 0 simplifies loop checks. code 0 must have a not-empty string values. See oss-fuzz issue 32758 and 32950 2021-04-01 Reini Urban indxf: calloc NULL strings empty string values are compared via strcmp and such. rather calloc a \0 byte, and don't crash. in_dxf is way too permissive, but we want to keep it that way. But only needed in fuzzed DXF files so far. Fixes oss-fuzz issue 32758 2021-04-01 Reini Urban indxf: reset j on non-vector fields we have several special cases for vectors or pts, where we need a global j counter. but when we set a single field, such as a num_clip_verts 91 or such. then we need to reset j, otherwise we could run into vector or pts overflows. As in oss-fuzz issue 32755 2021-03-31 Reini Urban indxf; fix NULL-deref with illegal DXF wrong points. Fixes oss-fuzz issue 32663 dim_blockname NULL-deref protection found by oss-fuzz issue 32639, but not repro anymore SHAPE spec: protect dxf from empty _ctrl->entries NULL-deref. oss-fuzz issue 32627, but not repro. See also oss-fuzz issue 32670. 2021-03-29 Reini Urban indxf: fix type unsafeties in dynapi set dont just check for a known common field name, but also its valid types before setting its defaults. In particular scale can be not just 3BD_1, but also H or BD, 2BD. grep '"scale"' ../src/dynapi.c Fixes oss-fuzz issue 32604 2021-03-28 Reini Urban fix in_json created_by leak should fix oss-fuzz issue 32408, which has an empty reproducer, but code-review brought me to that 2021-03-26 Reini Urban try to fix more indxf leaks but no 2021-03-25 Reini Urban indxf: protect from empty 3DSOLID 2 values fail with Invalid revision_guid earlier. Fixes oss-fuzz issue 32455 2021-03-24 Reini Urban spec: protect from NULL bit_eq_T args only with fuzzed/corrupt DWGs. Fixes oss-fuzz issue 32397 2021-03-23 Reini Urban outdxfb: NULL-deref in dxfb_process_VERTEX analog to outdxf. last_vertex might be NULL with broken objects (fuzzed). Fixes oss-fuzz issue 32348 2021-03-23 Reini Urban encode: protect NULL bit_write_TF chain With dwg_encode_xdata write a proper 0 size, but with lengths < 128 just write the empty string. Fixes oss-fuzz issue 32335, fuzzed dwgrewrite input only. This usually happens with overflowing (corrupt) XRECORD input. 2021-03-20 Reini Urban fixup indxf use-after-free from 3b47eb0fe81ab7ded5342208feac016076e0e668 dont just free the pair. Detected by oss-fuzz issue 32275 2021-03-20 Reini Urban outdxf: protect cquote src overflow fixes oss-fuzz issue 32251 2021-03-18 Reini Urban free: fix encode and possible leak in VBA_PROJECT leak detected by oss-fuzz issue 32179, but unfort. oss-fuzz produces an broken empty reproducer. also fix the encoding case, where we used to have an empty obj->size. this is much more important. the leak might happen with a proper decode of VBA_PRODUCT.data but bit_read_TF failing on overflow, whilst the VECTOR_CHKCOUNT check passed. A reproducer would be really nice to fix this for all fuzzed TF fields with variable len. This fix is just a hack. There is even a related testcase in to/2013/from_upcommons.upc.edu/DRAWINGS.dwg with a proper detection ERROR: Invalid data size 7168. Need min. 7168 bits for TF, have 90 for VBA_PROJECT. 2021-03-18 Reini Urban outdxfb: More NULL-deref protections as in outdxf fixes oss-fuzz issue 32171 2021-03-18 Reini Urban encode: disallow 3DSOLID num_blocks calculation from block_size[]. this might overflow with fuzzed/malicious data. all our input data (dwg. dxf, json) already sets num_blocks to a correct value already. Fixes oss-fuzz issue 32165 with dwgrewrite (broken block_sizes vector) 2021-03-18 Reini Urban clean more distcheck leftovers indxf: fix leaks with invalid objects or sections e.g. oss-fuzz issue 32094 2021-03-17 Reini Urban outdxf: uncondtionally zero-terminate cquote result because we immediately use strlen on it, which is on the stack. Fixes oss-fuzz issue 32112 (stack read overflow) more zero-termination fixes don't overflow when checking for zero-termination. asan is strict there. all our input paths enforce now zero-termination, so don't check. dat->chain[dat->size] must now always be 0. removed some weird dxf special-case where it was dat->size+1. gh action: -O1 asan times out. revert to -O0 2021-03-16 Reini Urban gh: add codecov.io integration, make distcheck coveralls.io is a bit too troublesome with our gcov files. Also add make distcheck, but only for --enable-release. And skip make check there, otherwise we will fall in the 60min timeout. 28min for the build, 8min for the check. 2021-03-16 Reini Urban indxf: improve fuzzer zero-termination don't allow \n without \0 in DXF. Fail earlier when the ASCII DXF buffer has none to avoid strtol overflows. Fixes oss-fuzz issue 32022 Also clear errno before calling strtol. 2021-03-16 Reini Urban llvmfuzz_standalone: protect from illegal input args accept only files. ftell might return (long)-1, which will lead to an malloc error 2021-03-14 Reini Urban more bit_utf8_to_TV src overflow protections commit 54fdafc75275f1848bcb4e79c0313b9a13a8b01b introduced src overflow protection, but not really. acctually check unprotected inc's. Fixes oss-fuzz issue 32029 2021-03-13 Reini Urban decode preR13: fix overflow regressions fuzzing only. crashes15 id 145 2021-03-12 Reini Urban encode: fix use-after-realloc in API_ADD_TABLE There is a small window of opportunity to realloc the objs invalidating ctrl. Fixes oss-fuzz issue 31436. decode: protect unsigned int overflow on wrong obj->size only with fuzzed dwgs. fixup llvmfuzz_standalone on non-linux no weak linking on macOS nor Windows. our mingw smokers have no sanitizers. indxf: disable unused and leaking dxf_objs add llvmfuzz_standalone for reproducers esp. if we fixup missing zero-termination. yes, we do. bogus oss-fuzz bug reports for 31419, et al 2021-03-11 Reini Urban indxf: pair -Wmaybe-uninitialized 2021-03-10 Reini Urban protect bit_utf8_to_TV src from overflow fuzzing in_json only, everywhere else the src is big enough. Fixes oss-fuzz issue 31878 Update NEWS, README dxfb: same protections as in dxf for fuzzing input add old gperf support needed for macOS CI target, which wants to generate dxfclasses.c with a gperf 3.0 outdxfb: resolve wrong ref->obj handles check against wrong ref->obj. enable llvmfuzz for outdxfb. 2021-03-09 Reini Urban Prepare NEWS for 0.12.4 indxf: better dxf_skip_ws overflow protection May fix oss-fuzz issue 31789, but not repro outdxf: forgot a LAYER_CONTROL entries case NULL-deref. Fixes oss-fuzz issue 31873 decode: protect bit_read_BB_noadv analog to bit_read_BB. Fixes oss-fuzz issue 31591 encode: fix write_DD for scale for INSERT. allow 1e-12 variance in equality check. Fixes GH #326 2021-03-09 Reini Urban encode: check if strings zero-terminate and re-calc the bitsize and size if changed. generally all dwg's created with r2004+ have zero-terminated strings, before not. Now the testcase with ./rw ../test/issues/gh326/Test_DWG_2000.dwg causes just 63 errors, not 187 anymore. See GH #326 2021-03-08 Reini Urban encode: add LOG_POS to strings decode: log used Section Page Map address 2021-03-08 Reini Urban decode: initialize bit_read_fixed on dat overflow Fixes GH #321. NULL dereference in header_variables_dxf.spec:26 Thanks to @zodf0055980 for the analysis. 2021-03-08 Reini Urban encode: avoid hdl_dat double-free In case of an handle overflow, such as num_reactors. Fixes oss-fuzz issue 31724. 2021-03-06 Reini Urban llvmfuzz: copy if JSON because we temp. zero-terminate strings in the JSON. Fixes oss-fuzz issue 31660, and kills libfuzzer performance. more decode_3dsolid fuzzing protections TF returns on overflow, but does not clear block_size. Fixes oss-fuzz issue 31657 outdxf: some NULL-deref protections with empty table entries. Fixes oss-fuzz issue 31656 outdxf: protect stack-allocated string from overflow at strlen. Should fix oss-fuzz issue 31647, but not locally repro decode: fix harmless klass->appname leak fixes oss-fuzz issue 31564 More FORMAT_RC -Wformat cast warnings this time for encode more decode_3dsolid fuzzing NULL deref better fix for oss-fuzz issue 31533 blocks_size needs to be reset also when TF overflows. Fix some FORMAT_RC -Wformat cast warnings from calc. int, and without optimization in COMMON_TABLE_FLAGS (Layer). Seems problematic, but we want to be warnings free to catch real errors. decode_preR13: more PREP_TABLE protections fixes GH #325 heap overflow 2021-03-06 Reini Urban more encode bitsize fixups needed all entities with a DD type have no stable bitsizes. need to recalc it there too. Eg LWPOLYLINE with example_2000 on dwgrewrite. also recalc size on was_bitsize_set 2021-03-05 Reini Urban encode: fix bitsize recalculation not just on unknown size/bitsize (DXF), also on JSON import and on rewrite across versions we need to recalc both sizes. e.g. on rewrite from r2004+ we miss the is_xdic_missing bit in all objects leading to an off-by-one bitsize. See GH #322 2021-03-03 Reini Urban Major outdxfb bugfix: write code 0 pairs outdxfb: fix table NULL-derefs Fixes GH #324, fuzzed by @zodf0055980. Analog to ascii dxf thumbnail: more bounds-checks protect from invalid header_size and BMP size. Fixes GH #323, fuzzed by @zodf0055980 more decode bounds-checking when the common entity already overflowed, dont parse further. such as e.g. with EED overflow. Fixes oss-fuzz issue 31576 acds: bounds-check invalid AcDs segment offset leading to heap-overflows with corrupt/fuzzed input data. Fixes GH #320, thanks to Yuan @zodf0055980 from Taiwan for fuzzing. 2021-03-01 Reini Urban decode_r2007: fail earlier with illegal system page data to avoid integer overflow in rounded calcs. Better fix for oss-fuzz issue 31574 geojson: protect dwg_geojson_object with broken object, without parent (dwg) Fixes oss-fuzz issue 31542 fix decode_3dsolid fuzzing NULL deref in case of an empty encr_sat_data[] block. Fixes oss-fuzz issue 31533 2021-02-28 Reini Urban llvmfuzz: set out_dat versions and opts dwg_read_dxf: set the opts here. needed for proper unicode conversions. as in our converters. bump copyright years to 2021 2021-02-28 Reini Urban encode: fix hdl_dat leak on errors when we have to return early within dwg.spec, such as HATCH errors and don't cleanup with DWG_OBJECT_END. Fixes oss-fuzz issue 31456 2021-02-28 Reini Urban VBA_PROJECT: ignore overlarge data_size which could lead to DDOS from malicious input, but mostly only pleasing fuzzers. Fixes oss-fuzz issue 31462 2021-02-28 Reini Urban llvmfuzz: fix leaks on input errors See e.g. oss-fuzz issue 31422 we skip leak detection with libfuzzer, but not with honggfuzz. note that in_dxf still leaks heavily, a known limitation. so we'd need to skip leak checks with honggfuzz also, or disable in_dxf there. fix encode_3dsolid num_blocks calculation not default to 100. take the number from the block_size array. Fixes oss-fuzz issue 31470 heap-buffer-overflow encode: fix fuzzing buffer overflow Fixes oss-fuzz issue 31516 detected by llvmfuzz 2021-02-28 Reini Urban llvmfuzz: enforce fuzzer data NULL-termination this is a workaround for a libfuzzer limitation. strtol or sscanf need a NULL-terminated buffer, or at least \n terminated. otherwise it reports buffer overflows. in real-code we enforce that in our input funcs. Fixes oss-fuzz issues 31450, 31419, 31454. 2021-02-27 Reini Urban indxf: break earlier ensure NULL-termination in dat_read_stream for sscanf, strtol and friends with asan. Fixes oss-fuzz issue 31454 2021-02-26 Reini Urban dwgadd: fix pspace command Closes GH #319, thanks to @chensccode encode: protect more API_ADD_TABLE cases Might fix oss-fuzz issue 31436 outdxf: wrong usage of strncat fix dxf_CMC overflows. detected by llvmfuzz outdxf: more dxf_tables_write NULL ptr protections might fix oss-fuzz Null-dereference READ · dxf_tables_write issue decode_r2007: protect from invalid repeat_count signed integer overflow with invalid input. fixes oss-fuzz issue 31432 encode: fix dat->chain[pvzadr] overflow fixes oss-fuzz issue 31426 decode: check decode_R13_2000 invalid classes fixes oss-fuzz issue 31425. outdxf: more cquote protection Fixes oss-fuzz Heap-buffer-overflow READ 1, issue 31416 tested with 0.12.3.4139 This bug was introduced with 0.10.1.3125 dwgadd/fuzz: fix wrong sscanf usage need the secure variant. esp. on windows fix some windows format warnings fix -Wold-style-definition minor make release-web fixups 2021-02-26 Reini Urban Release 0.12.3 Fix manual and release-web targets. 2021-02-25 Reini Urban encode: fix null-deref in DISABLE_NODSTYLE with empty NOD entries. detected by llvmfuzz fix outdxf overflow with Invalid shift-jis sequence \M+1xxxxxx detected by llvmfuzz indxf: abstract Premature DXF end to SAFER_STRTOL indxf: harden Premature DXF end errors we can assume there will always be a final " 0\nEOF" string. other string stream offset with r2010 Beta 2 samples. Fixes GH #318 WIP wrong string stream hisize offsets with Gator Beta 2 samples. See GH #318 to/2010/from_knowledge.autodesk.com/ outdxf: handle invalid SAB abort detected by llvmfuzz outdxf logging: avoid wrong bitsize position overflow detected by llvmfuzz outdxf: fix crash with stale VERTEX fail with empty last_vertex. detected by llvmfuzz outdxf: protect empty tio.entity detected by llvmfuzz indxf: hard error on invalid dxf pair before we simply returned 0 (or NAN) on invalid dxf pairs. now we set the stream to the end to force an early exit. 2021-02-24 Reini Urban indxf: protect dwg_read_dxf the same as dxf_read_file check if input size is too small, and if it's not a DWG. llvmfuzz used the latter, which was not repro with dxf2dwg. encode: convert assert address to error fix bit_eq_TU for NULL args or conversion trouble. detected by llvmfuzz LTYPE: protect against empty strings_area detected via llvmfuzz injson: fix TFFx buffer-overflow write max TFF size. detected via llvmfuzz encode: protect object dat pos 0 overwrites don't assert, fail. detected via llvmfuzz decode: Size underflow for R2004_Header detected by llvmfuzz fix injson double-free created_by is static detected via llvmfuzz outdxf: protect dxf_CMC string overflows with fuzzing. llvmfuzz 2021-02-23 Reini Urban prelim. NEWS for next patch release geojson: add PAIR_Sc for non-null values 2021-02-23 Reini Urban abstract TU_to_int for ubsan access which was totally wrong in some cases. but only with ubsan or HAVE_ALIGNED_ACCESS_REQUIRED. fix out_json print_wcquote for unaligned/UBSAN strings. 2021-02-23 Reini Urban llvmfuzz: close the null file-handle running out of it Fix dwg2dxf uppercase extension problem GH #311, esp on Windows indxf: detect dxf_read_* premature DXF end A DXF line must end with \n. detected via llvmfuzz indxf: fix add_HATCH overflow logic, wrong hdl_idx check detected via llvmfuzz bit_TU_to_utf8_len: fix heap overflow force string being delimited. deteced by llvmfuzz indxf: fix 3DSOLID overallocation detected via llvmfuzz indxf: fix MTEXT text running lines, DXF 3 detected via llvmfuzz dwgfuzz: add honggfuzz and llvmfuzz instructions See GH #317 add suggested __attribute__ ((noreturn)) to examples/dwgadd clang -Wmissing-noreturn some libfuzzer assertions. see llvmfuzz 2021-02-23 Reini Urban protect invalid geojson input via llvmfuzz. cd .build-clang m -C src && \ clang -I../src -Isrc -g -O3 -fsanitize=address,fuzzer ../examples/llvmfuzz.c -Lsrc/.libs -lredwg; LD_LIBRARY_PATH=src/.libs ./a.out -detect_leaks=0 -rss_limit_mb=8000 -timeout=4000 ../test/test-data/ 2021-02-23 Reini Urban replace prelim fuzz_dwg_decode.c with llvmfuzz.c with proper coverage 2021-02-23 davkor Added initial fuzzer for OSS-Fuzz integration. 2021-02-22 Reini Urban add release-web maintainer target docs: fix make refman out-of-tree doxygen update to 1.8.20 which deprecated several external programs 2021-02-22 Reini Urban Release 0.12.2 Fixed extending the write buffer for the 2 CRC bytes. Occurs very seldomly update .cirrus.yml autoconf update requires latest m4 fix bit_write_CRC overflow need to extend the buffer on write. Fixes GH #315 2021-01-31 Reini Urban Release 0.12.1 Fuzzer bugfixes and EED 3 for layer handle. See NEWS 2021-01-31 Reini Urban dwgbmp: fix Preview offset honor the sentinel, esp. >= 2004 and fix the size overflow check. dwgbmp works now again. 2021-01-31 Reini Urban unit-testing: -Wuninitialized MTEXT.num_column_heights 2021-01-31 Reini Urban fix eed_3.layer from 4 to 8 byte causing wrong offsets into the entities. many thanks to @shanzhugit for the DWG example with a EED layer code 3, and wrong entity data. Fixes GH #310. This is analog to the xdata OBJECTID which also takes 8 byte. 2021-01-31 Reini Urban bit_TU_to_utf8_len, bit_read_TU_len and swap the strict-align variants (ubsan) of wchar bytes 2021-01-30 Reini Urban dwgadd: -Wsometimes-uninitialized on clang 2021-01-17 Reini Urban decode: fix LOG_TF for null strings fuzzed DWG's only 2021-01-17 Reini Urban harden dwg_get_first_object not only check the type, but also if _obj is valid. Simplifies a lot of checks. dwglayers got a new error warning and early exit 2021-01-17 Reini Urban eed: detect size overflow earlier we read the size into a short, but multipled it with 2, with possible overflow. eg. with a wstring len of 32810 => 65622 overflowing an ushort. This may lead to a subsequent encode_eed overflow. Fixes GH #307, with invalid fuzzed DWG only 2021-01-17 Reini Urban decode: check wrong APPID_CONTROL's with malcrafted DWG's add more checks when we search for the matching APPID for ACAD_MLEADERVER with a broken MLEADERSTYLE object. Fixes 1/2 of GH #307 Modified-by: Reini Urban 2021-01-17 Reini Urban dwg_find_class: null-deref of empty class.dxfname which must not happen, but fuzzers create such invalid DWGs. assert more null args for internal code. Fixes GH #309 dwglayers: fail on empty layer name and report its handle. detected by fuzzing, only invalid DWG's have no layer name. Fixes GH #308 decode_3dsolid: skip unknown versions usually only needed for fuzzed DWGs See GH #304 json: more null-deref protections Fixes GH #306, fuzzed by Chew Kin Zhong decode preR13: stricter table checks error fatally on wrong end of table offset. heap-buffer-overflow from GH #304, but this code is not used in release versions. 2021-01-17 Reini Urban decode: wrong TFF VECTOR_CHKCOUNT, fix TFF overflows protect from invalid free on static TFF fields on overload. See GH #304, fuzzed by Chew Kin Zhong 2021-01-17 Reini Urban fix dwg_next_entity null-derefs with broken/undecoded entities from fuzzed DWGs. Fixes GH #305, out_svg. fuzzed by Chew Kin Zhong. 2020-12-31 Reini Urban Release 0.12 See NEWS. New add API to easily create new DWGs (or DXFs) from scratch, for CAD programs. New dwgadd helper. Removed deprecated old API functions. windows tests: remove \r on mingw cross-compile results windows tests: forgot some EXEEXT's which fixes i.e. mingw32 cross tests on linux. api: add portable SCANF_2X "%2hhX" for windows and removed most outdated sscanf %2hhX code, replaced by in_hex2bin. this failed on mingw32 unit-testing: fix include paths config.h is in build-dir, the rest in srcdir, all are covered in -I aready. failed in cmake: make check only. skip add fuzzing for --disable-write 2020-12-30 Reini Urban add examples/dwgadd taken from dwgfuzz -add, but extended. A nice and useful add API example. Still leaks memory though 2020-12-30 Reini Urban add API: fix use-after-free in ADD_ENTITY blkobj might be invalidated by an dwg->object[] realloc. This cannot happen with ADD_OBJECT (taking only dwg) and ADD_TABLE_OBJECT, where ctrl is only used if already exists and does not has to be added. add API: fix STYLE.name leak for the general case. 2x strdup 2020-12-30 Reini Urban dwgfuzz: try to use sscanf_s which glibc/bsd did not implements, because politics and they do not care about bounds checks. So to protect from stack overflows use %119s size bounds, and restrict the charset. We can do that for fuzzing, but for a real "add" language we would need to accept utf8, and write a real parser. 2020-12-29 Reini Urban clang -Wint-in-bool-context gcc didnt find this bug. but not relevant dxf: fix asan overflow in write eed of "" dxfwrite: fix STYLE IS_FROM_TU conversion api: delete wrong (out-of-date) dwg->*_control fields they are not updated when updating _ctrl->entries or num_entries, not on importers or on add. just delete this, it's easy enough to get it. outdxf: fix TABLES for imported dwgs remove tablectrl->objid, which is only set by decode, not by any importer nor the add api. check the table controls. sync out_dxfb from out_dxf add API: add PDFDEFINITION tests fix shared path defs, and create new dict names (base - 2) check that only one ACAD_PDFDEFINITIONS dict is created and shared. check that PDFDEFINITION objects can be shared, and that the name field is incremented. 2020-12-28 Reini Urban bit_eq_T: fix for imports indxf and injson dont convert to TU, which is used for dwg_find_dictionary() indxf: fix UNDERLAY fix object_alias and entity_alias for UNDERLAY. Add missing subclass for UNDERLAY, due to the UNDERLAY_fields macro which is not expanded add api: add_PDFUNDERLAY not yet fully implemented, PDFDEFINITION 1:1, not yet shared. TODO in_dxf. out_dxf and dwg looks ok. 2020-12-27 Reini Urban unit-testing: avoid *SURFACE DEBUGGING crashes the transmatrices may be NULL, even when dynapi returned sucesss. 2020-12-27 Reini Urban indxf: fixup wrong type would crash in free. fuzz 20, id: 293 also delete dead code, replaced by dwg_object_name() 2020-12-27 Reini Urban unit-testing: list all the no coverage objects dynapi: more NULL ptr protections esp. for pre-R13 DWGs api: fix dgndefinition cov and typedef promote ASSOCARRAYACTIONBODY to unstable nodist coverage, some transmatrix values are nan. spec: fix ASSOCARRAYACTIONBODY wrong subclass 2020-12-27 Reini Urban promote most DYNBLOCK objects and POINTCLOUD to unstable they have proper fields, and some coverage POINTCLOUD POINTCLOUDEX ASSOC2DCONSTRAINTGROUP ASSOCACTIONPARAM ASSOCARRAYMODIFYPARAMETERS ASSOCARRAYPATHPARAMETERS ASSOCARRAYPOLARPARAMETERS ASSOCARRAYRECTANGULARPARAMETERS ASSOCASMBODYACTIONPARAM ASSOCCOMPOUNDACTIONPARAM ASSOCFACEACTIONPARAM ASSOCOBJECTACTIONPARAM ASSOCOSNAPPOINTREFACTIONPARAM ASSOCPATHACTIONPARAM ASSOCPOINTREFACTIONPARAM ASSOCVARIABLE ASSOCVERTEXACTIONPARAM BLOCKALIGNEDCONSTRAINTPARAMETER BLOCKANGULARCONSTRAINTPARAMETER BLOCKARRAYACTION BLOCKDIAMETRICCONSTRAINTPARAMETER BLOCKHORIZONTALCONSTRAINTPARAMETER BLOCKLINEARCONSTRAINTPARAMETER BLOCKLOOKUPACTION BLOCKLOOKUPPARAMETER BLOCKPARAMDEPENDENCYBODY BLOCKPOINTPARAMETER BLOCKPOLARSTRETCHACTION BLOCKRADIALCONSTRAINTPARAMETER BLOCKSTRETCHACTION BLOCKUSERPARAMETER BLOCKVERTICALCONSTRAINTPARAMETER BLOCKXYGRIP PARTIAL_VIEWING_INDEX POINTCLOUDCOLORMAP POINTCLOUDDEF POINTCLOUDDEFEX POINTCLOUDDEF_REACTOR POINTCLOUDDEF_REACTOR_EX 2020-12-27 Reini Urban promote more dynblocks to stable: BLOCKALIGNMENTGRIP BLOCKALIGNMENTPARAMETER BLOCKLOOKUPGRIP BLOCKROTATIONGRIP to unstable: BLOCKPOLARGRIP BLOCKPOLARPARAMETER ASSOCDIMDEPENDENCYBODY indxf: more simplier dynblock import methods with just 2 args, as with else_do_strict_subclass. to be able to move grip objects to stable. indxf: add_RENDERSETTINGS but no coverage yet 2020-12-27 Reini Urban spec: fix ObjectContextData abstract AcDbTextObjectContextData_fields rename TEXTOBJECTCONTEXTDATA.flag to horizontal_mode, promote FCFOBJECTCONTEXTDATA to unstable, rename MTEXTOBJECTCONTEXTDATA.flag to attachment, fix spec MTEXTOBJECTCONTEXTDATA points and extents confusion: same order. disable AcDbObjectContextData.has_dic: no room in the *OCD.pi.log's, looks ok now. Almost all OCD objects do look stable now. 2020-12-26 Reini Urban spec: promote 7 objects to unstable PLANESURFACE, DATALINK, ALDIMOBJECTCONTEXTDATA, BLKREFOBJECTCONTEXTDATA, LEADEROBJECTCONTEXTDATA, MTEXTOBJECTCONTEXTDATA, TEXTOBJECTCONTEXTDATA unit-testing: more coverage dwgfuzz: fix SET_ENT -Wnonnull don't allow NULL into dwg_dynapi_entity_set_value. The compiler already warns, so should be fair. Without HAVE_NULL we explicitly check against NULL. unit-testing: use test_code_nodist for not distributed DWGs. We cannot add coverage for all stable objects yet. But some of them report FAIL, when we try a not existing test file. unit-testing: fix abstractobject_ASSOCARRAYPARAMETERS DEBUGGING only unit-testing: fix heap-overflow in 3dsolid tests We wrote size 4 into BITCODE_BS color. also fix wrong free's more dxf classes: AcDgnLS, Underlay, ... yet unused dynapi: improve abstractobject_ASSOCARRAYPARAMETERS Ignore duplicate object structs, add xref to the original. Fix dwg_api.h typedef struct _dwg_abstractobject_ASSOCARRAYPARAMETERS to fx unit-testing type warnings 2020-12-25 Reini Urban dynapi: unify duplicate abstractobject fields WIP spec: use abstractobject_ASSOCARRAYPARAMETERS typedef for the 4 same-struct classes. spec: set all subclass parents, not just the first major bug, but only used internally. indxf: break on wrong PERSUBENTMGR num_steps out of the loop. still wrong spec indxf: accept 3DSOLID code 3 line continuations indxf: fix HATCH with spline boundaries indxf: implement new RENDER* importers dwgwrite: remove experimental warning spec: promote some RENDER* objects to UNSTABLE RENDERGLOBAL, RENDERENVIRONMENT, RENDERENTRY unit-testing: fix SOLID header we were testing the wrong entity all the time unit-testing: add more coverage, but not in dist spec: fix DEBUGGING PARTIAL_VIEWING_INDEX_Entry.parent type 2020-12-24 Reini Urban add dwgfuzz -add support my sample .fuzz-in-add/fuzz-add, special dwgfuzz -add format: version 2000 text "test" (0.0 1.0 0.0) 8 attribute 8 0 "prompt" (0.0 1.0 0.0) "tag" "text" attdef 8 0 "prompt" (0.0 1.0 0.0) "tag" "default_text" block "bloko" line (0 1 0) (1 1 0) endblk insert (0 1 0) "bloko" 1 1 1 0 minsert (0 1 0) "bloko" 1 1 1 0 1 2 1 1 polyline_2d 2 ((0 1) (1 1)) polyline_3d 2 ((0 1 0) (1 1 0)) lwpolyline 2 ((0 1) (1 1)) arc (0.0 1.0 0.0) 0.5 0.0 3.0 circle (0.0 1.0 0.0) 0.5 polyline_pface 5 3 ((0 0 0) (2 0 0) (2 2 0) (1 2 0) (1 1 0)) ((0 1 2 3) (1 2 3 4) (2 3 4 5)) polyline_mesh 3 2 ((0 0 0) (2 0 0) (2 2 0) (1 2 0) (1 1 0) (0 1 0)) dimension_aligned (0 0 0) (2 0 0) (2 2 0) dimension_ang2ln (0 0 0) (2 0 0) (2 2 0) dimension_ang3pt (0 0 0) (2 0 0) (2 1 0) (2 2 0) dimension_diameter (0 0 0) (2 0 0) 2 dimension_ordinate (0 0 0) (2 0 0) 1 dimension_radius (0 0 0) (2 0 0) 1 dimension_linear (2 0 0) (2 1 0) (0 0 0) 90 point (2 0 0) 3dface (0 0 0) (2 0 0) (2 1 0) (0 2 0) solid (0 0 0) (2 0) (2 1) (0 2) trace (0 0 0) (2 0) (2 1) (0 2) shape "roman.shx" (0 0 0) 2 45 viewport "Viewport1" ellipse (0 0 0) 2.0 0.75 spline 3 ((0 0 0) (2 0 0) (2 1 0)) (0 2 0) (0 3 0) ray (0 0 0) (2 0 0) xline (0 0 0) (2 0 0) dictionary "ACAD_MATERIAL" "Global" 0 xrecord dictionary "REFRACTIONTILE" mtext (0 1 0) 10 "test\ntext" leader 2 ((0 0 0) (0 1 0)) mtext 15 tolerance "testtekst" (0 0 0) (0 0 1) mlinestyle "Double" mlinestyle.start_angle = 1.12 mline 4 ((3.9 1.5 0) (3.2 1.8 0) (4.6 1.0 0) (3.8 1.7 0)) dimstyle "Dim1" dimstyle.DIMSCALE = 2.0 dimstyle.DIMUPT = 1 ucs (0 0 0) (1 0 0) (2.5 0 0) "Ucs1" ucs.ucs_elevation = 1.0 layout viewport "Model" "ANSI_A_(8.50_x_11.00_Inches)" torus (10 5 0) (0 0 1) 19 2.78 sphere (10 5 0) (0 0 1) 15 cylinder (10 5 0) (0 0 1) 15 5 5 5 cone (10 5 0) (0 0 1) 15 5 5 0 wedge (10 5 0) (0 0 1) 3.3 2.4 4.8 box (10 5 0) (0 0 1) 3.3 2.0 2.5 pyramid (10 5 0) (0 0 1) 4.5 4 2.0 2.5 So there are variables: viewport and field.setters: dimstyle.DIMUPT = 1 with 3 types: int, float and utf8 strings. you can also set HEADER fields. 2020-12-24 Reini Urban dynapi: accept utf8text by default for setters dynapi: fail on dwg_obj_generic_to_object errors this can have user-input with wrong pointers dwgwrite: missing dwg_encode declaration this really belongs to dwg.h, but it uses the enriched Bit_Chain dat. So we need to use the dwg.c helpers instead. 2020-12-23 Reini Urban indxf fuzz: one more HATCH.paths[0].boundary_handles[] 330 fix 2020-12-23 Reini Urban indxf fuzz: protect from empty APPID_CONTROL on add APPID LibreDWG, when dwg_get_first_object APPID_CONTROL failed. we need to set the created ctrl also, for the handle later. crashes27.sh, id:169 2020-12-23 Reini Urban indxf fuzz: protect setting NULL ltype handle eg. ARC.ltype - Continuous where this handle is still NULL. crashes27 id:169 dwg_object_name: restrict to UPPERCASE 7-bit names for proper hash lookup. Only needed for fuzzing or wrong API usage. Fixes a lot of new indxf fuzzing crashes. The previous in_dwg_object() was more stable. 2020-12-23 Reini Urban fixup unit-tests: honor make -s silent MAKEFLAGS must not start with -s, "s -j3" was also seen Also improve check-minimal and check-debug targets. check-minimal only builds the minimal tests, not all. Repro: ms -pd -C test/unit-testing/ check check_PROGRAMS=3dface 2>&1 | less 2020-12-23 Reini Urban spec: more Constraint subclasses add Oda PARTIAL_VIEWING_INDEX no dxf. PARTIAL_VIEWING_FILTER not in dwg. 2020-12-23 Reini Urban dxfclasses.in: more SCENEOE class fixes IBL_BACKGROUND is apparently called RAPIDRTRENDERENVIRONMENT in DXF (in ODA), so merge that. In ODA GROUND_PLANE_BACKGROUND is called GRADIENT_BACKGROUND in DXF, but this looks like an ODA copy & pasta bug. 2020-12-23 Reini Urban dxfclasses.inc: clang detected missing commas expression which evaluates to zero treated as a null pointer constant of type 'const char *const' [-Wnon-literal-null-conversion] 2020-12-22 Reini Urban fixup unit-tests: more verbose without silent The goal is to speed up local tests during development mostly. smokes to run without make -s so far. unit-tests: honor make -s silent and use LOG_* logging Merge branch 'smoke/gh302-split' Fixes GH #302, completes the add API to be able to write new DXF's various gperf auto-generated object and class properties and dxfnames. encode: disable add_DUMMY_eed on windows mingw32: windows has different alignment/padding reserve more room for eed. esp. unsigned foo:1 is uint, not uint16 2020-12-21 Reini Urban indxf: fix mingw32 crash with wrong 1002 . "{" type the dxf 1002 string needs to be converted to 0 or 1. All other OS silently accepted the wrong type! Rename the EED field to u.eed_2.close 2020-12-21 Reini Urban dxf2dwg is not experimental anymore indxf: fix HATCH_Path.boundary_handles the root cuase was (unsigned)hdl_idx being -1, but I've added next_330_boundary_handles also. dynapi: no MPOLYGON.boundary_handles this is in the HATCH_Path subclass gh actions: split mingw steps 2020-12-21 Reini Urban move CLASS_STABILITY from array in classes.c to objects.in hash as field there. lookup went from linear to hash constant, but some type lookups need now to go via name. Since dwg_object_name is public, make the enum public also. libredwg.so size went from 79.898.656 to 79.898.920 (+264 byte) 0.11.1.4011 add_test: todo the failing dxf tests had 78.680.072 0.11.1 release: 78.886.896 2020-12-21 Reini Urban auto-generate classes.c stability arrays taken from classes.inc spec: promote BLOCKREPRESENTATION to unstable lots of new coverage, very same layout as DYNAMICBLOCKPURGEPREVENTER just other block handletype and dxf. fix tests for --disable-write add a @DISABLE_WRITE@ ac macro, not USE_WRITE as for automake and define add missing dxfclasses, and POLARGRIPENTITY no test yet, to check dxfclasses.in against classes.inc and objects.in. AC_CHECK_LIB xml2 probe esp. for cross-compilation, i.e -m32. probe system libxml2 first, without pkg-config support. skip test/xmlsuite then json: change EVAL_Node.node[4] repr in JSON The second static array for now. This should be generalized. bindings: fix -Wdiscarded-qualifiers in dwg.i wrong const dynapi: fix -Wnull-dereference xmlsuite: catch iter() returned non-iterator of type xmlCoreDepthFirstItertor caused by libxml2 being not upgraded to python3 __next__ iterators. Probably an outdated libxml2 module somewhere in your path. For me ~/.local/lib/python3.8/site-packages/libxml2.py overriding /usr/lib64/python3.8/site-packages/libxml2.py xmlsuite: create xml only for existing xml's and skip blocks. This messes up the result.htm comparison. and it speeds up the overly slow xmlsuite check. reformat xmlsuite python, improve entities tabify. improve entity support: Thickness, Normal, Spline, ... list of points. skip Model/PaperSpace/anon blocks free: avoid Wrong UNKNOWN type error ERROR: Wrong UNKNOWN_OBJ.type 513 for obj [214]: != ACDBASSOCPERSSUBENTMANAGER we free UNKNOWN_OBJ just fine by returning ERR_UNHANDLEDCLASS internal: simplify to memBEGINc which is the exact equivalent classes: auto-generate _dwg_dxfnames_variable[] also Too hard to maintain manually. silence wrong unit-testing/check-objects.pl TODOs spec: split BACKGROUND into 6 objects make full-regen-unknown 2020-12-20 Reini Urban dynapi: remove duplicate dwg_{entity,object}_names[] to save memory and avoid bsearch. use the hash lookup instead. This fixes the json importer start fixedtype offset at 500 for variable classes not 512, i.e. 0x200 objects.in: sort objects 2020-12-20 Reini Urban auto-generate O(1) _dwg_type_names_variable[] no linear search anymore: fixedtype -> name. also the reverse via the gperf hash: name -> type. now only the dxfnames tables in classes.c need to be auto-generated from objects.in 2020-12-20 Reini Urban split UNDERLAY objects, adjust gen-dynapi for abstract typedefs resolve some typedef aliases to structs. eg. Dwg_Entity_DWFUNDERLAY => struct _dwg_abstractentity_UNDERLAY doc: add add api and strings sections regen-dynapi line numbers gen-dynapi: keep generated objects.* if not changed. use dwg_object_name() in in_json hash lookup instead of linear search. check against proper dxfnames, and change from older json. check object/entity types and fail then. 2020-12-19 Reini Urban add gperf src/objects.c obj->name to dxfname, type and isent, gen-dynapi generated. 2020-12-19 Reini Urban dxf2dwg: fix leak on wrong file eg. programs/dxf2dwg -y -v3 example_2000.dwg ERROR: This is a DWG, not a DXF file: ../td/example_2000.dwg READ ERROR 0x800 ../td/example_2000.dwg ================================================================= ==1678362==ERROR: LeakSanitizer: detected memory leaks Direct leak of 21 byte(s) in 1 object(s) allocated from: #0 0x7f55fa6e7667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667) #1 0x402eba in suffix ../../programs/suffix.inc:53 #2 0x4043d7 in main ../../programs/dxf2dwg.c:299 2020-12-19 Reini Urban more proper IS_FROM_TU_DWG checks to handle indxf/add variants add api: avoid HEADER.unknown_text1 leak let dwg_handle_name always return a copy to fix json->dxf double-free's with r2007+, where the handle name was not converted to TU. 2020-12-19 Reini Urban fix dwg_handle_name with BLOCK, remove DIMENSION.blockname we overwrote the BLOCK_HEADER obj->name with BLOCK, which leads to double-free. Don't store a volatile DIMENSON.blockname (DXF-only), free immediately after use. 2020-12-19 Reini Urban free: fix BLOCK/DIMENSION name double-free same pointer, not a copy 2020-12-19 Reini Urban more text version fixes dynapi: check from_version on getters, version on setters. add_u8: check from_version (setter) add_XRECORD_string: simplify fixes dwgrewrite (no dwg->opts, keep TU strings on decode, convert in encode) 2020-12-19 Reini Urban eed, xdata: add is_tu bit don't rely on the dwg->opts and version flags. simply flag the source encoding. 2020-12-19 Reini Urban encode: fix add_DUMMY_eed from TU we need to write to the same version of the existing dwg version, not the target version. fix wrong TU len. and adjust the TU/TV eed string layout. same fields. changes the ABI. 2020-12-19 Reini Urban add api: when importing and using add_OBJECT copy the dxfname, and with INJSON even the name. See free.c Simplify dwg_obj_generic_dwg, use the add_APPID add_test: add dummy dwg_add_WIPEOUTVARIABLES to test possible dxfnames off-by-one errors in the static type array add api: set proper dxfname, add dwg_type_dxfname which can be derived by including classes.inc, but I want to avoid that. even if that means maintining two list of dxfnames. this is an immediate access array at least. no hash, no linear search. add api: set proper dxfname which fixes _3DFACE dxf 0 names add_test: ok passing tests add_test: convert the UTF-8 string args extend bit_utf8_to_T{V,U} with cquoted and disable unquoting for API inut, only for json strings 2020-12-18 Reini Urban add_test: todo the failing dxf tests 2020-12-18 Reini Urban WIP add api: start r2004 write support for DXF we can write r2018 DXF's, so fill those arrays also, not just the linked lists. fix get_first_owned_block() when writing DXF ENTITIES: We need to resolve all ref->obj pointers, but don't want to resolve all on each dwg_add_*() call, only when dwg_add_object did a realloc. We also do that at the first object and entity iterators. This commit caused double-free in BLOCK obj->name problems, when dxfwrite example_2004.json. 2020-12-18 Reini Urban add_test: prepare next testcases and new complex entities via temporary DWG_TYPE_ values. CHAMFER is not really an entity, but an operation on a 3DSOLID, like FILLET. add_test: extend to DXF with r2018 to test the new UTF-8 conversions, back and forth. UTF8->TU in add, TU->UTF8 in out_dxf and again UTF-8->TU in_dxf. add api: convert the UTF-8 string args via dwg_add_u8_input() add api: switch to UTF-8 encoding as with the dynapi. indxf: switch to the fast in_hex2bin variant indxf: abstract in_hex2bin to get rid of the overly slow sscanf "%2hhX" (120x slower) return klass->number from dwg_require_class/add_class more field docs indxf: fix ERROR: Invalid DXF code 1 for OLE2FRAME An oversight, i.e. no dxf testcase for OLE2FRAME indxf: fix ERROR: Invalid DXF code 2 for SHAPE An oversight, i.e. no dxf testcase for SHAPE indxf: fix ERROR: Invalid DXF code 10 for POLYLINE_MESH An oversight, i.e. no dxf testcase for PMESH'es 2020-12-17 Reini Urban dynapi: enhance common_set_value for ltype set some special ltype flags also 2020-12-17 Reini Urban dynapi: enhance header_set_value to set FLAGS when setting some magic fields, which are encoded as FLAGS. adjust #line's 2020-12-17 Reini Urban don't convert HEADER.CELWEIGHT from dxf only when converting it to the FLAGS value. Fixes add_test roundtrips, and keeps the sanified add_Document default of -1 2020-12-17 Reini Urban add api: outline more 3DSOLID primitives and add the missing add 3dsolid methods, nyi spec: change CONE args same as CYLINDER spec: promote ACSH_CONE_CLASS to stable We want to properly read and write it, and can easily read and write it. AddCone is a documented VBA API. .gitignore: more rebase helpers 2020-12-15 Reini Urban fix dwg_convert_SAB_to_SAT1 num_blocks when splitting encr_sat_data blocks, we need to adjust num_blocks also, otherwise we would free them wrong. the block_size[] list is ignored there add_IMAGE: copy file_path arg dxfwrite: huge error to write dxf when file did not exist 2020-12-13 Reini Urban add_HATCH segments and polyline paths for most supported entities. just not SPLINE, REGION yet. also improve the add_test plines, to look properly. add add_ent_reactor(), the common entity struct has a different layout. 2020-12-13 Reini Urban configure: disable -Wswitch-enum at all We mostly switch on DWG_TYPE_* which is much too intrusive. 2020-12-13 Reini Urban add -Wswitch-enum suppression, sanify CC_DIAG's, _GNUC_VERSION simplify the GCC warnings suppressor macros. add _GNUC_VERSION number, and adjust clang-specific numbers. for the add_HATCH type switch 2020-12-13 Reini Urban configure: probe for the GNU sincos() extension 2020-12-12 Reini Urban implement dwg_add_MLINE vertex_direction miter_direction not yet, but it seems to be the extrusion/normal vector for the segment, relative to the start_angle, to calculate the rotation matrix. 2020-12-12 Reini Urban fix dwg_add_MLINE, dwg_add_MLINESTYLE: set owner and reactor Fixes Removed 1 unread objects from entity lists. AcDbMlineStyle(27) Owner Id Is Null Fix it AcDbMlineStyle(27) Dictionary Reactor Missing Attach it AcDbMlineStyle(18) Placing AUDIT_E_201210225844-1 in ACAD_MLINESTYLE dictionary Total errors found 4 fixed 4 We already have the Standard MLINESTYLE in the dwg, as well as the current HEADER.CMLSTYLE. Add missing MLINE fields. TODO some vertex directions. 2020-12-12 Reini Urban fix dwg_add_MTEXT defaults Fixes mtext, leader: AcDbMText(27) was repaired. improve add_reactor, ensure absolute code 4 handleref fix dwg_add_INSERT block_header handlecode 5 fixes Reading handle 2B object type AcDbBlockReference Error 34 (eWrongObjectType) Object discarded AcDbBlockTableRecord: "bloko" Invalid BlockReference id add api: create Standard DIMSTYLE on demand when we add a new DIMSTYLE, or when we add a DIMENSION add api: document more experimental methods those which do not work yet add api: improve dwg_add_LEADER change its API, only accept MTEXT. set DIMSTYLE "Annotative" with an associated_annotation. add more defaults. 2020-12-12 Reini Urban dwg_add_SHAPE: set style_id (the shape no) to 1 which is wrong, but does not cause an error. The ODA description is certainly wrong. This fixed the error AcDbShape(27) shape number <= 0 1 but not AcDbShape(27) shape index <= 0 1 2020-12-12 Reini Urban fix gperf target wrong top_abs_srcdir macro 2020-12-11 Reini Urban add api: check illegal ELLIPSE values fixes AcDbEllipse(27) Radius Ratio > 1.0 set to 1.0 Also fixes Error 150 (eGeneralModelingFailure) because of wrong sm_axis.z value. add api: centralize more entity defaults set ent->thickness from HEADER.THICKNESS set ent->extrusion.z = 1.0 centrally doc: add Sections to the docs not yet via dynapi add api: check and normalize input values doubles can be nan, angles can be degrees or not-normalized to -180 .. 180 add api: add End-of-ACIS-data tag which would allow 0 num_records in the header. add api: cleanup ACSH_init_evalgraph remove unneeded vars and even allocs encode: fix block-wise dwg_encrypt_SAT1 buffer-overflows in encr_sat_data[] blocks. only relevent for the new dwg_new_3DSOLID() calls. add api: implement add_BOX even more points than with the WEDGE add api: implement add_WEDGE lots of points, and 2 unknown lengths c1, c2. TODO: acis_data block splitting seems to be broken doc: extend docs. add dynapi, add API add api: add ACIS base headers to all ACSH prims box, chamfer, pyramid, wedge. Their sat files look pretty big. 2020-12-10 Reini Urban add api: fix the ACIS headers add api: re-order ACSH objects, add ACSH_init_evalgraph helper and fix all the ownerhandle types to relative. now just the acis_data is wrong. add api: implement add_CONE and fix a couple of 3D things: EvalGraph.nodes, evalexpr, 3DSOLID.wireframe_data_present fixup EVALUATION_GRAPH BLd and unit-test 2020-12-10 Reini Urban add api: remove custom SEQEND prev/next fixups just use our in_dxf api, which also handles r2004+. fix a PFACE typo (_vtx vs _vtxf), but we still need to fixup PFACE links. all POLYLINE_* can now be added, without recovery errors. But recovery is still triggered, unlike with in_dxf. 2020-12-10 Reini Urban add api: simplify SEQEND and fix prev/next_entity links, esp. for subents add api: fix POLYLINE_* handle types add api: add stability warnings to the header 2020-12-10 Reini Urban improve gperf targets add cmake support (the generated .c still has a different header than the automake one) add regen-gperf target 2020-12-10 Reini Urban gperf: mingw64 fails gperf invocation ignore then. we do have the .c file around. gperf --output-file dxfclasses.c dxfclasses.in dxfclasses.in:62: warning: junk after %% is ignored dxfclasses.in:54: warning: junk after %} is ignored unsupported language option ANSI-C , defaulting to ANSI-C 2020-12-10 Reini Urban dxf_test: fix windows -Wpointer-to-int-cast warnings 2020-12-10 Reini Urban add api: add 2 mandatory LAYOUTs but without the VPORT, or PVIEWPORT handles for now. provide proper defaults for VPORT, VIEWPORT, VIEW. change dwg_add_DICTIONARY* api. no handlref arg, just the raw absolute_ref. Noe there is only one unread object warning remaining. 2020-12-10 Reini Urban add api: add missing LAYOUT dicts and objects Setting hdr ACAD_LAYOUT dict id.16 error opening *Model_Space's layout. Setting layout id to null. 16 error opening *Paper_Space's layout. Setting layout id to null. Salvaged database from drawing. Removed 1 unread objects from entity lists. add API: fix LTYPE_CONTROL.byblock types Now just the mandatory LAYOUT objects are missing. add_PLACEHOLDER owner and reactor acad complains and fixes it. add api: fix add_DICTIONARYWDFLT add to NOD if missing add_Document: add proper MLINESTYLE.Standard and empty ACAD_PLOTSETTINGS dict. Initial LAYOUT.Model still missing add api: delete old dwg_require_class add api: fix some wrong handle types NOD, object entries, entity owners, dict owners and reactors. 2020-12-09 Reini Urban spec: add EVAL_Edge EVALUATION_GRAPH.edges[] list of incoming and outgoing edges. now there is not more padding left. implement add_CYLINDER indxf: support EVALUATION_GRAPH.nodes spec: change EVALUATION_GRAPH list of EvalExpr nodes, with default edges of -1 api: add some geometric helpers from our SVG geom.c prepare empty dwg_normal_to_matrix9 just using the defaults. i.e. rotation not yet supported. 2020-12-09 Reini Urban add api: extend ACSH api with normal not just a xy rotation. acis needs that. but it is optional and defaults to {0,0,1} now we need some public arbitray-axis algo helpers: dwg_rot_to_normal(double, *3dpoint) dwg_normal_to_matrix9() 2020-12-09 Reini Urban implement dwg_require_class as gperf hash add dxfclasses.in. This is now faster and a less unreadable mess as before 2020-12-07 Reini Urban log ACSH.history_node.trans[] implement add_SPHERE with a much simpler ACIS template spec: change 3DSOLID_wire.selection_marker from BL to BLd signed, just as acis_index. Default: -1 add_TORUS: simplify use an earlier ASM version, which is simplier and can be read by earlier apps. Note LibreDWG as generator. dwg_add_3DSOLID: set block_size[] add api: add NULL checks and fix snprintf size add api: fix dwg_add_XRECORD_xdata add to the end, don't overwrite the head. spec: promote EVALUATION_GRAPH to unstable, fix 2 leaks add_Document temp added a BOLOCK_CONTROL.entry, which leaked. EVALUATION_GRAPH.evalexpr was added via add_TORUS, but was debugging, so leaked. fix add_3DSOLID wrong encr_sat_data size add api: reformat only add api: prepare rotation for ACSH solids add api: abstract dwg_init_ACSH_CLASS add origin_pt to history_node.trans right column the rotation not yet add api: add more require_classes This time with macros. But not all yet, only those we need TODO: This really should be done with a gperf hash. add api: implement dwg_add_TORUS via simple acis template. and promote to stable. spec: change 3DSOLID_wire.acis_index from BL to BLd (signed) There are many -1 add api: add most ACSH Entities and Classes WIP Each entity (a 3DSOLID) has linked EVALUATION_GRAPH, ACSH_HISTORY_CLASS and each ACSH_object_CLASS for the original 3DSOLID creation params 2020-12-07 Reini Urban add api: add experimental APIs {LAYER,SPATIAL}{FILTER,FILTER} just for SPATIAL_FILTER I have coverage also PROXY_{ENTITY,OBJECT} add IMAGEDEF_REACTOR to IMAGE 2020-12-07 Reini Urban configure: improve ASAN detection to CC not just CFLAGS github-actions: declare ASAN in CFLAGS, not CC configure.ac only checks CFLAGS for asan. hence doesnt detect it, and fails on memory leak checks with the known leaking in_dxf. github-actions: asan without bindings still does timeout. 2020-12-06 Reini Urban spec: RTEXT is Remote Test not ROTATEDTEXT DEBUGGING. Fix the DXF subclass name. debug: add AcDbAssocActionBody to AcDbAssocAnnotationActionBody spec: rename ATEXT to ARCALIGNEDTEXT still DEBUGGING add api: remove DIMENSION_ALIGNED.def_pt argument 2020-12-06 Reini Urban define HAVE_DWG_ADD_ and HAVE_NO_DWG_ADD_ to auto-generate APIs, as e.g. for gambas from src/objects.inc we don't have yet add api's for all objects, entities. The list was autogenerated with one-liners of perl, diff, cut, sort. 2020-12-06 Reini Urban api: dwg.h does not define USE_WRITE config.h does, but this is not exported. External projects may need write support. 2020-12-03 Reini Urban msys2: seperate appveyor from gh-actions again restore appveyor build-aux/msys2.bat, fix typo. gh-actions uses its own recipe. 2020-12-02 Reini Urban appveyor: restore build-aux/msys2.bat broken by gh-actions generated config.h.in is reworded travis: disable all but --enable-release gh-actions are now good enough add api: fix TABLE.ownerhandle 2020-12-02 Reini Urban add api: fix add_Document BLOCK_CONTROL.{model,paper}_space types. fix DICTIONARY fields: ownerhandle, reactor, cloning. default TABLE.is_xref_ref to 1. 2020-12-02 Reini Urban add_test: fix most leaks api: improve VBA_PROJECT support and add a test. WIP: needs a dict, appears still empty in the dwg. add api: validate object,entity types add api: add VBA_PROJECT, LAYOUT and fix MLINESTYLE regen-dynapi gh actions: skip work/ branches 2020-12-01 Reini Urban gh-actions: no cmake matrix just the one used for SolveSpace cmake: fix *.test perms 2020-12-01 Reini Urban --disable-write fixes dont install a crippled shared lib with cmake, which is mostly use for in-tree cmake variants. enable USE_TRACING (for debugging) disable the add API with --disable-write 2020-12-01 Reini Urban improve gh-actions setup-python setup-python-libxml2 add cmake with all options run make distcheck only with --enable-release note that with --disable-bindings, make distcheck will always fail. 2020-12-01 Reini Urban fixup gh-actions no sudo various quirks Add GH actions, as new YAML PR #130 cmake: improve config.h expansion 2020-12-01 Reini Urban api: support DISABLE_JSON in dwgread, d*write, in_dxf, dwgfuzz, and the testcases. move find_numfield from in_json to in_dxf, because it is used there also, and we can disable json now. 2020-12-01 Reini Urban configure: add --disable-json for a very slim library, such as for SolveSpace 2020-12-01 Reini Urban Support slimmer cmake builds cmake args: -DLIBREDWG_LIBONLY=On -DLIBREDWG_DISABLE_WRITE=On -DLIBREDWG_DISABLE_JSON=On Esp. for SolveSpace. Also add more tests. Fixes GH #299 2020-12-01 Reini Urban configure: probe for HAVE_PYTHON_LIBXML2 only when we have the XML2_LIBS, and not --disable-python. just to skip test/xmlsuite spec: fix more 32bit type errors UNDERLAY.num_clip_inverts BL -> BS VISUALSTYLE.face_modifier r2010+ BL -> BS spec: fix UCS.num_orthopts from BL to BS 2020-11-26 Reini Urban add_test: re-enable DICTIONARYWDFLT passes now, after we require the class before. 60a70c8158ab77db0f0210e64c4d1258fd923100 api: fix heap-overflow in DWG_GETALL_OBJECT oops, this was undertested. xmlsuite: improve PYTHON quoting esp. for systems with spaces in the python path. See 78d1b58d1bf2ef22b746d8a7763ff5ec1202de78 add api: fixup add_REGION add api: fix most INVALIDTYPE errors we need to add the class before our variable object. otherwise we would need to fixup our type afterwards. add_Document: add missing require_class ACDBDICTIONARYWDFLT dwg_find_dictionary: -Wnull-dereference xmlsuite: add python shebang Seokhwan Cho reported /check.py: line 1: import: command not found with python 3.9 on macOS add_test: better LIBREDWG_DEBUG verbosity to find out which test to debug. skip the 2 broken tests unless debug. also set DICTIONARYWDFLT.defaultid, but variable types are still broken. add api: copy acis_data also add api: support XRECORD values 2020-11-25 Reini Urban api: change all dwg_ent|obj_generic* to void* so we don't need to cast around. for XRECORD find the dict->key to set add api: add GROUP, MLINESTYLE to nod fix dwg_add_DICTIONARY_item to check if the key already exists. add GROUP and MLINESTYLE api and dicts add api: cover now all testcases well, almost add_test: LIBREDWG_DEBUG=cnt controls with single test to run and add a couple more tests. e.g. LIBREDWG_DEBUG=13 LIBREDWG_TRACE=3 add api: more add_Document defaults c++-compat: warning: excess elements in array initializer add api: even more dwg_require_class 2020-11-24 Reini Urban add api: more dwg_require_class add api: fixup ATTRIB links add_test: add SPLINE add api: register INSERT in blkhdr->inserts and register added obj handles in the hash. otherwise we will not be able to find them. fixup -Wdiscarded-qualifiers for internal in_postprocess_SEQEND() api: add more LOG_ERROR and improve unit-testing/add_test.c: need to add the new BLOCK to a new BLOCK_HEADER (WIP) add api: fix dwg_ref_object resolver by fixing the dwg->dirty_refs state. only dirty it when object[] is realloced. also pass the dwg->opts loglevel to the decode and dwg modules on add. silence the BLOCK_HEADER null warning add api: set ENTITY.ownerhandle esp. for complex plines. add api: remove dwg_dup_handleref add helper dwg_obj_generic_handlevalue(). set mline->mlinestyle (found via nod) 2020-11-24 Reini Urban api: fixup add api for pts[] esp. dwg_ent_lwpline_set_points() and the new _add_POLYLINE ones. add tests for complex polylines, simple spline. add our old importer fixups to link the ents, and provide new style vertex/attrib arrays (e.g for r2004+ DXF creation). change dwg_add_document to dwg_add_Document and add 2 more args (version and loglevel). 2020-11-24 Reini Urban api: enhance add for complex entities add Attribute to insert (with BLOCK ATTDEF and INSERT ATTRIB). change add API to take entities to which to add subents (VERTEX, ATTRIB) to. unit-testing add_test enhancements. 2020-11-24 Reini Urban api: more add methods fix the remaining decls unit-testing: extend add_test and fix some found const-free bugs. support INSERT block names. api: remove R_2021 / AC1035 r2021 still uses the r2018 format 2020-11-23 Reini Urban unit-testing: silence add_test warnings bump LIBREDWG_SO_VERSION to 0:12:0 improve unit-testing/add_test.c for distcheck 2020-11-22 Reini Urban api: fix/stabilize mspace add refs take the new ref in the test after reading it in from the dwg this fixes add_test 2020-11-22 Reini Urban api: add_document fill the dictionaries and more details. fix some invalid free's on const strings. fix BLOCK/ENDBLK links and special cases. Checked against an original acad2000 empty dwg for the defaults. I cannot read acadiso.dwt still. 2020-11-22 Reini Urban api: honor dwg_add_document(metric) and minor logging beauty 2020-11-22 Reini Urban api: improve add_TABLES add new api's: dwg_get_first_object(dwg,type) and dwg_get_first_OBJECT(dwg,type), because getall is not really suitable for that. We only need to search for the single CONTROL object and dont want to scan the whole dwg. Fixup Dwg_Object_OBJECT conversion to Dwg_Object. Add a dwg->next_hdl hack for holes in dwg_add_document(). 2020-11-21 Reini Urban api: add tables with its control object api: more work on dwg_add_document first initialization unit-testing: add add_test to test the basic add API NEWS: Describe the latest and planned changes for 0.12 api: add classes support for some objects/entities. plus more entities api: more add entity functions HATCH has a special AddOuterLoop function. We rather combine that, taking some objects and using its handles. 2020-11-20 Reini Urban api: add some add_OBJECT functions in VBA XRECORD is added to a DICTIONARY api: more add functions The .so has now 14MB api: more add helpers dwg_add_to_mspace is not needed anymore. add dwg_add_entity_defaults, dwg_dup_handleref and dwg_insert_entity to link the blkhdr with the new entity. api: improved add functions add to the current block (mspace, pspace or block) as in VBA. this enables linking the new entity into the block. c++: fix basic c++ compatibility restrict is __restrict __nonnull has a different index, disable it. WIP api: add some basic add functions for write functionality: SolveSpace, GauchoCAD. Just the layout. api: disable deprecated dwg_api all object-specific field getters and setters. re-enable with -DUSE_DEPRECATED_API 2020-11-19 Reini Urban cmake: enhance to programs and lto fixup the HAVE_PCRE_* defines. need to be undef'ed if not found. 2020-11-18 Reini Urban python -no-undefined and LIBS to enable shared otherwise the python binding will be static only. 40MB Windows release .zip's is too much. extend dxf-allcvt.lsp for more silent crashes 2020-11-16 Reini Urban Release 0.11.1 See NEWS. Mostly out_dxf fixes to enable acad dxfin for most generated DXF (~90%). No API changes dynapi: adjust line numbers unit-testing: fix a SEGV with NULL BLOCKLOOKUPACTION.lut in 2010/sun_and_sky_demo indxf: make failing dwg_has_subclass check non-fatal Several subclasses still missing. Fix them over time. For now fixed all stable and unstable classes. Fixes GH #295 dynapi: change _type_subclasses to _name_subclasses we cannot yet sort by enum Dwg_Object_type (fixedtype), so we need strings. Add more subclasses: AcDbDimension Fixup wrong subclasses for LAYOUT, VERTEX_3D, PLOTSETTINGS. Fixup fields macros with args. Skip them for DXF/ENT defaults. Fixes TABLE_value.data_string See GH #295 2020-11-16 Reini Urban WIP add has_subclass API for the previous indxf fix. We need to check if a subclass belongs to a class, or which subclasses are valid in a class. Parse dwg.spec for all SUBCLASSes and fill in a new dwg_type_subclasses[] array, sorted for bsearch. We expand more defines now. Also parametric _fields (). See GH #295 2020-11-15 Reini Urban indxf: check 1 proper DETAILVIEWSTYLE for subclass TODO: this needs to be generalized. A shorter subclass into a wrong class will overwrite unallocated memory. heap-buffer-overflow, such as in crashes29 id 73 fix oob in bit_convert_TU wrong length calculation. e.g. crashes8 free: fix BLOCK.name double-free dxf sab: max 4096 encr_sat_data block_size Split it up into chunks. The blocksize should not exceed 4096. Error 30004 e.g. The 3DSOLID 2E1 in example_20* Also keep the End-of-ACIS-Data teigha always writes it, and it can be imported. 2020-11-14 Reini Urban fixup DIMSTYLE re-order, duplicate DIMTXSTY leading to messed up handles and a leak. 2020-11-13 Reini Urban dxf: fix read oob in SAB 2 caret expansion free 3DSOLID.history_id The few history_id (3.0.0) handles still leak though. 2020-11-13 Reini Urban dxf: fixup improve dwg_dim_blockname r2007+ it is already converted to utf-8. don't convert it twice, use FIELD_TV0 instead. fixes model-mechanical_from_uloz.to_2013 2020-11-13 Reini Urban decode: fix empty classes, e.g. r13c3 And add -v5,6 logging to r2000 classes Fixes GH #294 fix debugging unit-testing/blockuserparameter changed API comments: new idea for classes the problem is that some r13c3 classes fail to be read. See GH #294 debug: silence MPOLYGON cast warnings logs-all.sh: revise abstract abs_dwgread, longer timeouts, adapt to renamed test-old dirs 2020-11-12 Reini Urban spec: add DEBUGGING BLOCKREPRESENTATION fields dxf: don't skip IDBUFFER r13-r14 dxf: fix UCS misspelled the UCSTableRecord dxf: change the T dxf continuation group 1 from 3 to 1 TODO: investigate which field switches from 1 to 3 for continuations... Fixes overlong TEXT.text_value (jis_a0) fixup dxf: split overlong 1 strings into groups of 3 forgot to advance the str, and used a wrong format template. dxf: convert shift-jis text \M+1xxxx to \U+xxxx but overly simplistic. for just the hiragana and katagana letters, not the full cjk range yet. dxf: optional DIMENSION.dimstyle fixes "Invalid dimension style name." dxf: improve dwg_dim_blockname() and dwg_handle_name() needed for DXF dxf: skip linewt 370 0 for non-lines (SEQEND, VERTEX*) when are dxf 370 default? with lines 1d (ByLayer) is default, without 1c (0). also fix the indxf default linewt. 2020-11-11 Reini Urban spec: promote ACSH_HISTORY_CLASS to stable spec: work on ACSH_HISTORY_CLASS => unstable needed for the previous commit. r2007+ 3DSOLIDs need that. add fieldnames, no evalexpr nor historynodes. dxf: dxf_check_history_id r2007+ needs the 350 history_id for the DXF. search all our objects and assign the first one dxf: remove AcDbShPrimitive from ACSH_CHAMFER_CLASS dxf: remove AcDbShPrimitive from ACSH_FILLET,BOOLEAN_CLASS e.g. 2007/ATMOS-DC22S_from_cadforum.cz 2020-11-11 Reini Urban dxf: avoid nan, only with DEBUG_CLASSES fixes BLOCKBASEPOINTPARAMETER in 2007/blocks_and_tables_-_imperial which would be a PROXY_OBJECT without AEC. Before we avoided nan only for releases. 2020-11-11 Reini Urban dxf: hardcode major.minor for EvalExpr and BlockElement fixes 2007/blocks_and_tables_-_metric dxf: fix AcDbBlockScaleAction BlockAction_ConnectionPts offsets dxf: fix some HEADER texttypes e.g. $STYLESHEET, $HYPERLINKBASE dxf-allcvt.sh: renamed the test-old dirs and adjust crashing dxf imports dxf: fixup AcDb3dSolid subclass with DXF only print 100, 350 if r2007+. e.g. example_2007, 2007/ATMOS-DC22S with DWG read 350 only for version 2. fixes up 991808b3280aa2034e3177e19efa3f2195dd9d49 2020-11-10 Reini Urban dxf: skip final SAB End-of-ACIS-data line this is only SAB relevant, but not for the DXF 2020-11-10 Reini Urban dxf: split overlong 1 strings into groups of 3 with max chunk length 255. enhance dxf_fixup_string to do the quoting and splitting. With SAB->SAT conversion do the splitting in the SAT file already. This has no groups 3. 2020-11-10 Reini Urban improve dxf-allcvt.lsp optional prompt for next, optional erasure to avoid Duplicate block warnings filter out more crashes dxf.in: name the dxf as in log for the test-old data. eg. Reading DWG file test/test-old/AC1012/from_autocad_r14/overhead.dwg Writing DXF file overhead_from_autocad_r14_AC1012.dxf dxf: add SAB tag 23 for int64 see https://github.com/jmplonka/InventorLoader/ scandir() needs also _NETBSD_SOURCE why they dont take just _BSD_SOURCE is beyond my comfort level. See https://nxr.netbsd.org/xref/src/include/dirent.h#111 Thanks to Iain Hibbert for the report and suggestion. 2020-11-08 Reini Urban dxf: fix 3DSOLID r2007+ Add missing 100 . AcDb3dSolid and 350 . history_id even for version 1 SAT data. Fixes GH #282 2020-11-07 Reini Urban add examples/filt_sat.pl, dec_sat.pl filt_sat.pl: to compare two decoded sat files. dec_sat.pl: decode DXF encrypted sat files. e.g. rem extract the encrypted 1 groups from a DXF into a seperate file for s in "`cat TS1_2000.dxf.encr`" do ./dec_sat.pl "$s" | grep -v "^ n" done | ./filt_sat.pl > TS1_2000.dxf.decr 2020-11-07 Reini Urban dxf: remove AcDbAlignedDimension.oblique_angle 52 from DXF Unexpected DXF group code: 52 for in_dxf looks like we need to calculate it, but actually it's always the default 0.0 dxf: use ACAD_ prefix for PROXY_{ENTITY,OBJECT} not a variable class 2020-11-07 Reini Urban SAB: accept tag 21 as enum long constant just guessing what the exact format is. The enum seems to be the previous identifier. e.g. exact_int_cur <21> $0 means the identifier int_cur has the value exact and a constant $0 ?? See GH #291 2020-11-07 Reini Urban indxf: accept some invalid color groups as acad dxfin does also. those dxf's appear in the wild, probably from other dxf exporters. Fixes GH #290 2020-11-07 Reini Urban dxf: fix 3DSOLID dxf encoding Replace all "^" chars by "^ ". For the decoding in in_dxf we already do the reverse. Fixes GH #283 2020-11-07 Reini Urban WIP dxf: SPLINE re-ordering provide defaults for tolerances. TODO: knots and ctrl_pts with Bezier (scenario 2) for DXF only dxf: optional 3DSOLID.acic_ampty 290 dxf: improve BLOCK groups 70, 1, 4 when taking the BLOCK_HEADER values. esp. fix the groups 70 (hdr flags), 1 (xref path name) and 4 the optional description. 2020-11-07 Reini Urban dxf: re-order DIMSTYLE and many optional values, even CMC0 (color) TODO: There are many different default values, not just 0 and 1. esp. with DIMSTYLE. The Standard style has no values at all in DXF. maybe add FIELD_B_opt (name, dxf, def) 2020-11-07 Reini Urban dxf: Move PSPACE entities from BLOCKS to ENTITIES Iterate over all ENTITIES not just from model space, but also from paper space. There would be three variants how to order them. We choose to list first all owned mspace, and then all owned pspace entities. Should fix these DXFIN error messages: * Entities not allowed in *Paper_Space block definition * Error: Block "*Paper_Space" was not defined Thanks to @mozman for explaining the problem to me, and coming with the nice dxfpp tool with ezdxf. Fixes GH #277 2020-11-07 Reini Urban dxf: fix STYLE Invalid textstyle name for shapeFile: "SHAPE$0$REF" Such names need to be empty in the DXF output, when STYLE.is_shape is set. Fixes GH #287 dxf: fix r13c3 crashes in DICTIONARY with empty text also extend dxf-allcvt.sh 2020-11-07 Reini Urban fix XRECORD VT_INT64 xdata from BLL to RLL for all VT_INT64 xdata values. also add the missing INT64 case to out_dxf for XRECORD xdata. Fixes #289 This did not change the public API, only a comment in dwg.h 2020-11-07 Reini Urban dxf: fix MLINESTYLE angles keep the DWG angles (and hope they are in range) but range restrict the rad2deg DXF variants. accept 90.0001 or such. Don't use FIELD_BD(), this would do rad2deg again. The DXFIN fix is: MLINESTYLE Bad mlstyle start angle. 2020-11-07 Reini Urban spec: avoid STYLE.flag logging at free only needed at en/decode fix bit_convert_TU out-of-bounds by 1 2013/flipped_cleaned at TEXT.text_value spec: default TEXT.width_factor = 1.0 and skip if default on DXF dxf: skip LAYER.material 347 which is an unstable class. it would point to an invalid handle. dxf_file.pl: improve rounding of all numbers honor negative numbers. keep only 6 after-comma places. do so by rounding float numbers in perl by ourself. dxf: fix SPATIAL_FILTER.origin to 11 SPATIAL_FILTER Error: expected group code 11 dxf: fix HATCH.scale_spacing 41 Error: expected group code 41 41 is not optional if 1.0, with 2013 dxf: fix Layer name with vertical bar is not marked dependent wrong flag 70 mask. Only mask of plotflag and linewt, but not 0x10 (xref dep) spec: fix LTYPE with shape_flag 74: 2 the dashes.text value calc. was wrong. dxf: fix PDFUNDERLAY: Unexpected DXF group code: 170 i.e. num_clip_inverts dxf: SPATIAL_INDEX has no ObjectDBX but only in DXF 2020-11-07 Reini Urban dxf: extend LAYER.plotflag for DEFPOINTS extend the special-case of f53d2deb820bf2fb300345c78d1a95fb9d2ff4d5 to be case-insensitive. Fixes Publish_2004.dxf Also a typo of the color logs 2020-11-07 Reini Urban dxf: re-order MULTILEADER failed all over with DXFIN, from r14-2018. This crashes now Leader_200{0,4}, but fixed all MULTILEADER errors. dxf: fix VERTEX: Bad visibility value 2 take only bit 0 of ENTITY.invisible => 60 . 1 dxf: avoid duplicate STYLE eed 1000/1001/1071 for ttf data dxf: re-order LEADER dxf: re-order ENTITY.ltype_scale 48 right after ltype 6 2020-11-07 Reini Urban dxf, json: fix DIMENSION_ANG2LN Unexpected DXF group code 10 Fix missing JSON def_pt 10 for most DIMENSION entities. 2020-11-07 Reini Urban dxf: fix SUBCLASS version check dxf: no 70 in AcDbOrdinateDimension Unexpected DXF group code: 70 2020-11-07 Reini Urban improve dxf-allcvt.lsp to autoimport all now with custom match filter, with logging to file, fast (no safety prompt). we cannot close the fresh DXFIN tab, as within autolisp it is not. and purging the new blocks produces too many lines in the log file. so rather keep up with our Duplicate block warnings 2020-11-03 Reini Urban dxf: fix ATTDEF for r13-r14 dxf r13-r14: fix Class separator for class AcDbText expected dxf: before r2000 keep only some variable objects which should also handle PLACEHOLDER from before dxf: skip ACDBPLACEHOLDER before r14 e.g. r13/RAY The following error was encountered while reading in ACDBPLACEHOLDER starting at line 1918: Class separator for class AcDbPlaceHolder expected Invalid or incomplete DXF input -- drawing discarded. dxf: skip 100 . AcDbDimStyleTable before r2000 Fixes a couple of r14 dxf's. dxf: fix STYLE.flag calc from is_vertical and is_shape bits the other way round. is_shape is bit 1 dxf: no $SAVEIMAGES with r14 only r13/AC1012 dxf: fix pre-r2000 HEADER starting with $TDCREATE if without {}. Error 372 in drawing header on line 428 dxf: remove $DIMSAV from HEADER not in DXF at all 2020-11-01 Reini Urban dynapi: regen VISUALSTYLE changes here we need to take the first decl, not the last one prelim NEWS for 0.11.1 Summarize the fixes so far dxf: re-order VISUALSTYLE esp for r2013. This fixes DXFIN for VISUALSTYLE. 2020-10-31 Reini Urban dxf: re-order more common DIMENSION fields flip extrusion with ins_scale in DXF. move the group around text_rotation 54,51,210,53 to the end. there's no ins_scale and 2nd def_pt 10 in DXF. blockname 2 is optional Fixup 2018/Dynblocks.dwg to be r2018, not r2004. 2020-10-30 Reini Urban dxf: skip DIMENSION 72 and 41 defaults of 1 add BS1 and use BD1 for lspace_style and lspace_factor dxf: fix wrong DIMENSION.flag 70 calc e.g. flag1 = 11 (LINEAR) should be converted to flag 32 [70] untested: inverse indxf conversion flag => flag1 refactor MPOLYGON analog to HATCH refactor HATCH.boundary_handles move to paths[]. This fixes GH #280, dxf. 2020-10-30 Reini Urban dxf: re-order HATCH move 97 and 330 out of loop. 330 boundary_handles as vector before 75. no gradient_fill if off. move to the very end. write SOLID instead of SOLID,_I Partial fix for GH #280. see next commit. 2020-10-30 Reini Urban appveyor: less cygwin tests we constantly run into test timeouts dxf: use "%-16.16f" for floats, maxlen 18 to match acad ascii dxfout better 2020-10-30 Reini Urban decode_r2007: repair Invalid string stream data_size which happens with type>500 objects on r2007. start all 3 streams at the same offset, the obj->address. The problem was to assume str->byte == 1 (8 bit offset) which was wrong with larger obj->type or obj->size MS sizes. avoid duplicate obj_handle_stream() Fixes GH #279 2020-10-30 Reini Urban dxf: ATTDEF re-ordering dxf: honor dxf 0 for points some points need to be skipped, e.g. BLOCKSCALEACTION dxf: ATTRIB re-ordering dxf: always print LAYER.plotflag 290 with Defpoints See GH #275 dxf: ATTRIB defaults dxf: re-order TEXT.vert_alignment 73 must be after SUBCLASS (AcDbText). And fix ATTRIB.vert_alignment to group 74. dxf: flip lineweight sign use BSd not RC, which represented 140 as -116. See GH #275. Tested all lineweights. dxf: re-order VIEWPORT fix bit_convert_TU for 128-255 wrong UCS-2 to UTF-8 conversion for the chars 128-255 skip more DXF defaults: 290, 284 ENTITY.shadow_flags 284 is optional LAYER.plotflag 290 also. fix DXF 10<=>30 for TEXT the elevation is after the ins_pt 10,20 of course. Also fix DXF for 11 and 210. Thanks to GH #275. 2020-10-30 Reini Urban summaryinfo: fix types T to TU16 The length is RS prefixed. fix HYPERLINKBASE default: when encoding to later versions, we might need to convert the type This fixes the 2007/colorwh dxf part for the SummaryInfo section, GH #275 2020-10-30 Reini Urban dxf: fixup TU strings convert \r\n to ^M^J for ASCII dxf. See GH #275 with 2007/colorwh, an AutoDesk example dwg 2020-10-28 Reini Urban Fix out_geojson with r2007+ Text must be converted from UTF-16 to UTF-8 for MTEXT, TEXT and GEOPOSITIONMARKER. Thanks to @chensscode, GH #271 2020-10-22 Matthew Broadway fixed dockerfile 2020-10-09 Reini Urban in_dxf: fix one wrong BLOCKALIGNMENTPARAMETER.prop_states type we allocated for double but need only BITCODE_BL. harmless bug, but found when looking at hardened -Wincompatible-pointer-types c++: more c++ compat revert some c++ compat casts from 6d0295d60b1a3ea589ed44c5290fb07c3f38894b. Avoid -Wincompatible-pointer-types with DWG_ENTITY and ADD_TABLE_IF 2020-10-08 Reini Urban msys2: fix broken msys2 mirror update to latest image VS 2019, which does not need a complete update. 2020-09-18 Reini Urban c++: more c++ compat at least for some private headers also. cmake: add basic library support Only for external cmake apps, like for the solvespace integration. Only the lib, no programs yet. 2020-09-14 Reini Urban .gitignore: support clangd/lsp server hint: make clean; bear make 2020-09-05 Reini Urban fixup {en,de}code VALUE types for -Wformat with int immediates, such as VALUE_BS (1, 70), where int i must be cast to unsigned short. 2020-09-04 Reini Urban perl: enable tests out-of-tree perl: drop unneeded LibreDWG.xs swig creates the .c for us fix latest -Wformat-truncation= which thinks that %lX can be 2-17 byte long dxf_test: skip 2018/Helix inside docker Closes GH #268 2020-09-04 Reini Urban Dockerfile: get latest release via tar add another Dockerfile-master for testing git master. add a check-docker target to test the current state, which needs a distdir build-arg. 2020-09-02 Reini Urban Improve Dockerfile (GH #268) add pcre2 dep. pass DOCKER=1 to make check to skip testing unstable objects Workaround bogus -Warray-bounds 2020-08-22 Reini Urban fix dwg_rgb_palette_index detected by gcc-10.2 -Warray-bounds 2020-08-10 Reini Urban dat_read_file: protect fileno 2020-08-07 Reini Urban spec: post-release fixup 2020-08-07 Reini Urban Release 0.11 See NEWS. Many new features, esp. json, dwgfilter, dxfwrite, all sections, ACIS v2 support, assoc and constraint objects, many bugfixes. Also minor breaking API changes. decode: fix dwg->object leak when the very first object[0] is invalid. Detected by fuzzing hangs35 id:000034,src:001498,time:242855345,op:its,rep:32 free: fix acis_sab_hdl leaks Detected by fuzzing crashes35 id:000034,src:001498,time:242855345,op:its,rep:32 2020-08-05 Reini Urban spec: add comments for alternate MESH field names from dxfgrabber/blender 2020-08-04 Reini Urban decode: protect from illegal ACDS.segidx_offset to avoid out of memory calloc decode: -Wmaybe-uninitialized r2007 pages_map decode: add another read_R2004_section_info out of range check we already check ptr overflow for all num_sections before, but somehow this fuzzing case bypassed that. Fixes GH #265 by @seviezhou api: VT_BOOL clashes with mingw64 wtypes.h Thanks to @ZalivahaAM GH #264 spec: fixup wrong FIELD_2DD used with DXF only no idea what drove me there. Thanks to @ZalivahaAM GH #264 decode: fix obj_string_stream overflow handling to avoid heap overflows, such as in fuzzing GH #262. Fixup not only str_dat to avoid wrong bounds, but also the culprit, obj->bitsize. 2020-08-03 Reini Urban decode_r2007: prevent from read_sections_map overflows wrong file_header.pages_map_size_comp or sections_map_size_comp or repeat_count. 2020-08-02 Reini Urban msys2: another pacman update attempt decode: protect empty r2004_header.section_map_address Found by fuzzing GH #260 by @seviezhou decode: protect from invalid ACDS.num_segidx Fixes fuzzing GH #259 by @seviezhou fixup LTYPE.dashes overflows 4b99edb0ea26 as fix for GH #255 was wrong by *2, the offset is wide. Also apply the same boundschecks to the ASCII case pre-r2007, via strnlen. Fixes fuzzing GH #258 by @seviezhou free: fix HANDSEED double-free with dxf --minimal. It really is a global ref now. Found via fuzzing GH #257 by @seviezhou 2020-08-01 Reini Urban unit-testing: improve MATERIAL and re-arrange the field decl a bit, for properly aligned BD* spec: fix MATERIAL.map the 2nd mapper transmatrix was wrong, we need a texture here. This caused a double-free if map.source == 2. Only found via fuzzing GH #256 by @seviezhou. 2020-08-01 Reini Urban probe for wcsnlen et al to use the native wchar funcs on windows/aix/solaris, also for wcsnlen fixup wcs2*len decl to POSIX compat. use POSIX compat decl, which broke cygwin. cygwin declared both, and reported the mismatch. 2020-07-31 Reini Urban decode: protect LTYPE.dash_i from overflowing 512 Add bit_wcs2nlen with maxlen. Fixes fuzzing GH #255 by @seviezhou decode: prevent thumbnail overflows the thumbnail size may not be negative. Fixes fuzzing GH #253 by @seviezhou 2020-07-31 Reini Urban decode: improve appinfo is_teigha check with corrupt APPINFO.version string shorter than 6 chars. e.g. by fuzzing. Fixes GH #252 fuzzing by @seviezhou Also extract 2 more common fields upfront. 2020-07-31 Reini Urban decode: fix check_POLYLINE_handles NULL deref detected by @seviezhou via fuzzing. Fixes GH #251 2020-07-30 Reini Urban unit-testing: enable BLOCK_CONTROL which needs a different loop. selected at run-time! disable 2 yet unneeded functions only needed when we can write 2004/ resp. turn off the importer string hacks dxf: fix MINSERT / AcDbMInsertBlock upgrade INSERT to MINSERT on indxf. the 0 . dxfname is just INSERT indxf: -Wuninitialized with -O spec: replace OBJECTCONTEXTDATA by ANNOTSCALEOBJECTCONTEXTDATA OBJECTCONTEXTDATA is apparently only a subclass, but ANNOTSCALEOBJECTCONTEXTDATA does exist as DXF . 0 encode: fixup EED for indxf ACAD.BLOCK_HEADER "DesignCenter Data" EED crashes ACAD with r2000-r2004. Closes GH #244 encode: disable some indxf EED blocks otherwise ACAD import crashes, see blocking GH #244 unit-testing: fix dynapi_test for evalexpr.value.text1 this pointer is only valid for some evalexpr types. which is already checked by a full evalexpr memcmp 2020-07-30 Reini Urban appveyor: import msys packager keys See https://www.msys2.org/news/ "Alexey is stepping down from his role as the main packager and two new packagers have been appointed in his place: David Macek with signing key 0x9078f532 Christoph Reiter with signing key 0xa0aa7f57 You can see the keys in full without relying on keyservers in the msys2-keyring GitHub repository. We have released a new msys2-keyring package from that source (and a new installer that includes them) and we are waiting for a bit before uploading new databases and packages to give people time to update." 2020-07-30 Reini Urban dynapi: re-add UNHANDLED names and add COMPOUNDOBJECT subclass (we guessed two fields already) free: add _private API needed for type conversions. not exported, but to free.h so that it can be used by encode. dispatch only by type, not dxfname. 2020-07-30 Reini Urban encode: skip unstable objs WIPEOUT and TABLEGEOMETRY which will crash/hang acad open. See GH #244. We rather dont skip them at import (indxf/injson), because it might be dxfwrite. 2020-07-30 Reini Urban demote WIPEOUT to unstable looks stable (even after bitwise comparison), but causes acad import to crash on redraw, See GH #244. Now dxf-check with example_2000 works again. Fixes GH #244 2020-07-29 Reini Urban travis: extend distcheck timeout to 30 from the default 20m for make distcheck indxf: fixup HATCH.boundary_handles use a seperate counter, realloc with path[1]. spec: fix AcDbBlockAction.deps handle code dwg.in: support --big and overlarge input files and skip timeout then. No extra TIMEOUT_50 needed. encode: fix bit_copy_chain for huge hdl_dat For large handle buffers we might need to allocate more than one CHAIN_BLOCK. Fixes crashes in Dynblocks BLOCKVISIBILITYPARAMATER at "Flush handle stream of size 28488 (@3561.0) to @429.0" spec: BlockVisibilityParameter and BLOCKGRIPLOCATIONCOMPONENT fixups wrong handle and dxf codes spec: add EvalExpr to DYNAMICBLOCKPROXYNODE dxf: fixup AcDbBlockMoveAction same natural DXF order as AcDbBlockStretchAction demote BLOCKSTRETCHACTION back to debugging definit. wrong DXF dxf: fixup AcDbBlockStretchAction this has the natural DXF BlockAction_ConnectionPt order indxf: minor DYNBLOCK fixups fix BLOCKLINEARPARAMETER.distance DXF code add BLOCKPARAMVALUESET logging 2020-07-29 Reini Urban indxf: add_AcDbBlockRotationParameter esp. for the 1011 pt, which should not be EED simplify the else_do_strict_subclass dispatch 2020-07-29 Reini Urban indxf: AcDbBlockActionWithBasePt and AcDbBlockRotationAction promote BLOCKROTATEACTION to stable 2020-07-29 Reini Urban spec: refactor BlockAction_ConnectionPts use an array afterall. DXF uses a different vector layout, not array of structs. represent the key in dynapi without the [n] size, as there are different sizes per objects. 2020-07-27 Reini Urban add BLOCK{FLIP,MOVE,STRETCH}ACTION indxf: improve FIELD_3BD indxf: add_AcDbBlockAction indxf: add_AcDbBlockVisibilityParameter indxf: add_AcDbBlock1PtParameter indxf: add_AcDbBlock2PtParameter and add_BlockParam_PropInfo indxf: fix ASSOCACTION.actionbody already fixed in the spec, but forgot in indxf. dxf: fixup AcDbSectionViewStyle.identifier_position order and few more minor indxf fixes indxf: read AcDbBlockParamValueSet values needed for stable dynblocks promote to unstable: BLOCKALIGNMENT{GRIP,PARAMETER} and BLOCKROTATE{ACTION,GRIP}, which can be promoted to stable with indxf 2020-07-27 Reini Urban promote most unstable DYNBLOCKS to stable BLOCKVISIBILITYPARAMETER: one minor error BLOCKLOOKUPGRIP, BLOCKXYPARAMETER: no coverage re-arrange coverage blocks. The first occurance must have coverage, else it will fail (for stable objects). 2020-07-27 Reini Urban add TIMEOUT_50 for dwg in_dxf nees some more time than others. e.g. indxf Dynblocks with asan needs 35sec on my fastest CPU indxf: fix MTEXT.column_heights to 46 indxf: BLOCK.filename 4 in some DXFs indxf: add AcDbBlockElement, AcDbBlockgrip support and FIELD_3BD, COMMON.ltype_scale indxf: fix HATCH CHK_polyline_paths wrong check. free SUB_FIELD_VECTOR fixes acds leaks test-data: add Dynblocks.dwg for dynblocks coverage. from test-old, which is not distributed. so that many dynblocks can be promoted to stable. (just indxf missing yet) 2020-07-24 Reini Urban promote to unstable: BLOCK{FLIP,LINEAR,LOOKUP}GRIP 2020-07-23 Reini Urban indxf: convert common ENTITY 370 linewt spec: fixup some BlockGrip fields the first bg_version is rather some state, like bl92. the dxf code for combined_state was wrong spec: add AcDbBlockElement to AcDbBlockGrip subclass promote to unstable: BLOCKSTRETCHACTION 2020-07-22 Reini Urban promote to unstable: BLOCKFLIPACTION unit-tests: improve BLOCKSTRETCHACTION add CHK_ENTITY_2DPOINTS promote to unstable: BLOCKSCALEACTION docs: fixup classes for its stability promote to unstable: BLOCKVISIBILITYPARAMETER dwggrep: add new objects promote to unstable: BLOCKBASEPOINTPARAMETER, ... and BLOCKFLIPPARAMETER, BLOCKMOVEACTION, BLOCKROTATIONPARAMETER spec: fix BLOCKUSERPARAMETER AcDbEvalVariant NULL = -9999 we cannot decide on a not read value promote BLOCKXYPARAMETER to unstable just indxf missing, analog to BLOCKLINEARPARAMETER promote BLOCKLINEARPARAMETER to unstable just indxf missing unit-tests: fix BlockParamValueSet subclass checks decode: fix AcDbBlockParamValueSet SUB_FIELD_VECTOR did not allocate BD* valuelist dynapi: add BLOCKPARAMETER_* subclasses missed a _ prefix. Fixes the BLOCKPARAMETER_PropInfo unit-test failures (DEBUGGING only) dynapi: fixup line # fix DEBUGGING unit-tests some renamed fields 2020-07-20 Reini Urban indxf: more ent->nolinks fixups reset nolinks if any prev or next_entity is empty. convert_SAB_to_SAT1: use CAN_ACIS_* feature macros convert_SAB_to_SAT1: skip history lines r2013+ We cannot deal with them yet, preventing 3DSOLID's to be imported at all. convert_SAB_to_SAT1: for old-style DXF fixup the End-of-ASM-data line adjust the ACIS data for the DXF according to the target version. Just not the history lines yet 2020-07-20 Reini Urban indxf: handle truecolors set the correct index on c3 colors. Fixes LAYER colors dxf: convert colors across r2004 postprocess_SEQEND: log links from dxf or json, when converting linked list from/to vector unset nolinks when needed. (first or last vertex) dxf: fix POLYLINE_* flag values always set the type flag and the elevation pt POLYLINE_3D.curve_type 75 is optional 2020-07-20 Reini Urban indxf: fix LWPOLYLINE.num_bulges always write const_width 43 set bulges flag. Fixes dxf roundtrip error with example_2013 on LWPOLYLINE 156 2020-07-20 Reini Urban decode: log computed revision_guid encode: fix add_LibreDWG_APPID error handling critical errors should not add PLACEHOLDERs. Like Out of memory, control not found, and such. spec: -Wunused-variable encode: add missing initializers encode: compute HANDSEED the next available handle from dwg->object_refs encode: simplify xdata strings a bit 2020-07-19 Reini Urban injson: disable wstring always import as TV/UTF8 bits: add IS_FROM_TU(dat) macro to have the importer hack logic for strings in one place 2020-07-19 Reini Urban undo parts of the importer hack keep a proper dat->from_version, synced to dwg->header.from_version rather check all encode write_T (fields, eed, xdata) if it came from an imported string (indxf or injson), which would be UTF8, never TU. This way we can keep all the right structure checks PRE (R_*)... and only checks strings if imported from UTF8 or not. 2020-07-19 Reini Urban indxf/json: fixup in_postprocess_SEQEND code 3 => 4 r2000 linked attribs/vertices need to be handle code 4, but the vector is code 3. fix that encode: downconvert CMC colors from r2004+ to r2000 decode: protect r2007 empty system_page map Check file_header.sections_map_correction and file_header.sections_map_size_comp params. Found via fuzzing by @yangjiageng, GH #248. dwgwrite: windows fopen fixups we need to open the infile rb, otherwise dat_read_file will read less than the filesize (collapsing \r\n to \n). and the error message was never printed. 2020-07-18 Reini Urban dxf: LAYER.plotflag 290 not optional It is with ODA, but ACAD complains when it's missing. spec: silence -Wduplicated-branches warning with print and free dxf: fix missing ENTITY.preview_size the bug that was worked around in the previous commit. DXF has IS_PRINT indxf: support ENTITY.preview without preview_size code 92/160 realloc it along. Fixes MULTILEADER.preview in example_2000.dxf, though technically it is illegal and an OUTDXF bug omitting the code 92 . preview_size injson: importer hack for xdata strings indxf: protect in_postprocess_SEQEND from !owned but the bug/regression must be happened before programs: more importers hacks faking dat->from_version reset to R_2000 (no unicode stored) when importing from DXF or JSON for now we check the structure with dwg->header.version and TU with dat->from_version injson: unquote \\ back to \ e.g. in viewlabel_pattern like %<\AcVar ViewDetailId>% (%<\AcVar ViewScale \f "%sn">%) which had two \\ but every ordinary test also. encode: fix XRECORD.num_xdata off by one. repro with example_r14 json-roundtrips. write to r13-r14, not just r2000 this is a target version hack, until we can write all versions. the helpers wrote only r2000 injson: keep target dat.version at R_2000 fixes unicode EED strings change TU logging to UTF-8 decode xdata: avoid wrong xdata_size warning dxf: fixup GEODATA dxf fields dxf: simplify ENTITY.ltype_scale spec to BD1, as with the scale vector. and more such scale/x_factor fields. dxf: fixup BLOCK 67 . 1 is_paperspace DXF-only flag it is already in common_entity_handle_data.spec entity previews exist only since r13 api: rename DICTIONARYVAR .intval => schema, .str => strvalue 2020-07-18 Reini Urban dxf: optional INSERT fields and some re-ordering, 66 before 2. TODO: extrusion in R12 dwgs? 2020-07-15 Reini Urban indxfb: some B=>RS fixups, generalize VALUE_INT out_dxfb out_dxfb fields should all look at the resbuf type width, not just RC => RS. in_dxf unfortunately has some exceptions, with 280 DWG being B, but DXF being RS, and such. This needs to be adjusted in the spec. we can now read and write until TABLES (HEADER and CLASSES), until the first objects. 2020-07-15 Reini Urban indxfb: support RC, B types before we only read RS for RC/B dxf: BLOCk entity comments dxfb: generalize VALUE_RC for all objects we really need to check the dwg_resbuf_value_type for the width with DXFB, not the DWG RC/RS/B suffix. dxbf: minor simplifications no changes but VPORT.render_mode to RS in dxfb 2020-07-14 Reini Urban dxfb: start fixing OBJECTS harmonize with out_dxf api: change eed[].u.eed_5.entity from RLL to unsigned long add dxfb-check and check-dxfb target analog to dxf-check, just no proper roundtrip checks yet, instead of that we try teigha for out_dxfb and in_dxf dxfb: fix TABLES version-specifics and 1 wrong APPID type dxfb: fix CLASSES types wrong RL and RS in_dxfb: fix dxf_read_string dxfb strings are not len-prefixed, just ordinary ASCIIZ strings (like handles). dxfb: fix handles They are just %lX strings. dxfb: more HEADER DXFB improvements more version checks, more type fixes. consistent bracketing to allow if() HEADER_ groups 2020-07-13 Reini Urban dxfb: fix HEADER_RC types to RS 2 bytes short, not 1 ./dxf: fix bashism, check for dash and use awk for substrings then dxfb: let dxf support dxfb and -o to override the output file with -b/dxfb, like $base_bin.dxf our old dxfb example was r2018, not r2000. dxfb: fix $ACADMAINTVER type to RS/RL 2/4 byte, not 1 dxfb: fix TU strings, no 999 comments The documentation says 999 comments are not supported. Unicode strings need to be converted to UTF8, as in Ascii DXF add dat_read_size, a fast bulk file read dat_read_stream was a bit slow. later we need to switch to mmap anyway indxfb: major fixes in dwgwrite: fill dat, ... 2020-07-12 Reini Urban indxf: change the experimental warning messages works now mostly, but still can cause crashes or misses some tricky entities indxf: add VISUALSTYLE.props, more version hacks props needed for r2013+ handle FIELD_CMC with optional 420 pairs 2020-07-12 Reini Urban indxf: help dwg_fixup_BLOCKS_entities by creating entities[] without a list of block entities we cannot create a linked list. The helper add_to_BLOCK_HEADER is only used with ENTITES (adding to mspace) but not the BLOCKS entities yet. 2020-07-12 Reini Urban indxf: dwg_fixup_BLOCKS_entities for adjacent refs nolinks must be set for all adjacent refs, to skip 8.0.0, 6.0.0 links 2020-07-12 Reini Urban dxf: more version hacks for strings treat DXF like JSON, only decoding to TV (R_2000 alike) and then when encoding use a fake dat->from_version. dat->from_version is fake with INJSON and INDXF, dwg->header.from_version is real. use the dwg->version for structural checks. 2020-07-12 Reini Urban dwgwrite: simplify dwg_version default add bit_eq_T, support r2007+ *Paper_Space checks... looks like the last r2007 indxf limitation is now fixed indxf: fixup BLOCK_HEADER.{first,last}_entity relying on the new_object &i was too fragile. 2020-07-11 Reini Urban encode: create r2004+ entity vector in SEQEND when upconverting r2000 linked lists to the attribs/vertex vector also adjust the versions logic, while we dont set the target version yet in the importer. so we have to provide variants for all possible versions. (just not unicode strings yet) 2020-07-11 Reini Urban encode: create r2000 linked entity list in SEQEND in_postprocess_SEQEND needs to link the vertex[] or attribs[] entities when downconverting. This is normally done in in_postprcess_handles, but prevented from entmode=0 there. with indxf this is not yet enabled, because dwg->header.version is higher than R_2000 on downconvert. it is not yet set to the target version, dat neither. 2020-07-11 Reini Urban api: rename field attrib_handles back to attribs was renamed for TABLE, but also used in INSERT. This is much more consistent with the POLYLINE*.vertex[] vector indxf: fix owned vertex[]/attrib[] handle types POLYLINE/BLOCKS own entities via handle code 3, not 4. dxf_postprocess_SEQEND (See also #138) 2020-07-11 Reini Urban encode: fix r2004+ incompatible version error Acad import failed to import r2004+ versions (saved as r2000), because of dwg->header.zero_one_or_three being 0. Adjust the header versions (dwg_version/maint_version being the version of the app writing it). This bypasses now the "Drawing file created by an incompatible version." error and crashes later with an original r2004 dxf2dwg when importing the mspace block. Converted r2007+ DXF's do work fine though. JSON imported r2004 DWGs (as r2000) can be ACAD opened also, just indxf not. 2020-07-10 Reini Urban clang-format -i in_dxf.c reformat only indxf: start simplifying FIELDs promote DETAILVIEWSTYLE SECTIONVIEWSTYLE to stable implement indxf importer. They are needed for the NOD (Named Object Dictionary) and were easy enough to implement. The spec was stable for some time 2020-07-09 Reini Urban dxf: defer in_postprocess_handles to after entmode we cannot find the prev entity when we haven't set ent->entmode yet. This fixes r2000 next_entity linking when there's a obj between to skip, like a GROUP. Fixup relative handles for all entities (prev/next chains). indxf: Fixup HATCH.boundary_handles code. 2020-07-09 Reini Urban dxf: optional common_entity_handle_data fields 6 . ByLayer 62 . 256 2020-07-09 Reini Urban dxf: fixup BLOCK_RECORD 70 not optional. actually not printed at all harmonize DXFB with DXF 2020-07-09 Reini Urban dxf: fix FIELD_BINARY it repeated the first 310 block all over, oops api: rename VPORT_ENTITY_HEADER => VX_TABLE_RECORD, VPORT_ENTITY_CONTROL to VX_CONTROL. rename SECTION_VPORT_ENTITY to SECTION_VX. As in DXF (But there only VX_TABLE_RECORD) 2020-07-09 Reini Urban dxf: enable VBA_PROJECT 310 blob. This now can import dxf-check DWGs as first for a long time. 2020-07-09 Reini Urban dxf: add missing BLOCK_HEADER 310, 102 preview was missing and also {BLKREFS 331 } dxf: re-order XDICOBJHANDLE for tables after the handle, before the ownerhandle. dxf: re-order BLOCK_RECORD 1st mspace, 2nd pspace, and then the rest. flag 70 is optional there. 2020-07-08 Reini Urban dxf: fix TIMEBLL ms value ms, not seconds json: fix HATCH.boundary_handles path.num_boundary_handles was ignored on injson, leading to empty boundary_handles in the DWG export 2020-07-08 Reini Urban api: BlockReference renames insertion_pt, data_flags harmonize all insertion_pt to ins_pt, TABLE.data_flags to TABLE.scale_flag also fix JSON export/import for most scale fields. This fixes Acad Zero scale warnings on such imported blocks. 2020-07-08 Reini Urban indxf: fix VISUALSTYLE.color 62/420 ignore those, always index 5 indxf: implement add_ASSOCNETWORK analog to ASSOCACTION indxf: implement ASSOCACTION VALUEPARAM and EVALVARIANT imports. api: promote TABLEGEOMETRY back to stable Was stable in 0.10.1 There is one unknown geom field 95 indxf: fix TABLEGEOMETRY.tablegeometry handle code from 5 to 4 rename TABLEGEOMETRY num_rows/cols to numrows/numcols for json json ignores all num_ fields, because the can be computed from the array. but those two are not bound to the cells array, only num_cells. This broke TableGeometry JSON roundtrips when importing into acad, with empty values for both. This fix could push TABLEGEOMETRY from unstable to stable. 2020-07-08 Reini Urban spec: ASSOCACTION add VALUEPARAM *values acad can now read them properly, but values are still missing to be imported from DXF. fix more DXF and Handle codes. 2020-07-08 Reini Urban spec: fix ASSOCNETWORK AcDbAssocAction ASSOCNETWORK was too small, caused by missing AcDbAssocAction fields. We really should be able to call ASSOCACTION_private already. For now duplicate the fields into its macro. Also fix the handle eWrongObjectType codes. Fixes the ASSOCNETWORK acad dwgin errors, can be promoted to stable. 2020-07-08 Reini Urban spec: fix _3DFACE didn't read the spec properly, the invis_flag is absent on has_no_flags. Fixes acad dwgin of 3DFACE entities. encode: fix eed handles we did write the wrong handles without raw (e.g injson, indxf) encode: fix START_HANDLE_STREAM for entities dump the common entity handles same as common object handles, before writing the specific handles. interestingly only broke WIPEOUT and a few r2000 prev/next chains dynapi: fix CMC imports CMC is an inlined struct, not indirect. Also the r2000 shortcut to copy only the short index is wrong for all truecolor colors even with r2000. such as CELLSTYLEMAP bg_color with 0xc8000000 colors (none) all over. indxf: fixup color.method and color.rgb esp. with method c8 None. But also with injson and encode. spec: analog add all missing HANDLE_STREAM markers some entities even had wrong END markers spec: fix SCALE streams json roundtrips (encode) missed the SCALE std streams: ownerhandle, reactors, xdicobjhandle spec: demote DIMASSOC back to DEBUGGING acad dwgin fails with DIMASSOC, as encoded by json. dxf: ENTITY.thickness 39 is optional 2020-07-08 Reini Urban dxf: fix ENTITY.preview_size dxf code dxf: *_CONTROL.num_entries 70 is already correct do not subtract the default entries. indxf: fix first BLOCK_HEADER.entry when we move out an ctrl.entry of the list, destructively change the entry index in the caller. Otherwise we get the next one at 1, even we just deleted index 0. encode: fix eed_data size calc. byte size, not bitsize downgrade TABLEGEOMETRY to unstable it breaks acad dwg open. as unstable dwgin works now indxf: SET_CTRL_BIT from flag set the various extra table control bits from flag 70 doing it in encode in the dwg.spec is not good enough. dxf: mask off loaded bit 6 from COMMON_TABLE_FLAGS no 70 . 64 dxf: optional DIMSTYLE fields 3, 4 and 40 are optional. re-DXFOUT example_2000.dxf from r2018. It had many different handles from the DWG, and it used as reference. indxf: improve postponed eed APPID logging print which object had a postponed EED APPID handle dxf: re-order LAYER 290, 370, 390 put plotflag 290, linewt 370 and plotstyle 390 after ltype 6. mask off linewt and plotstyle from LAYER.flag 70 2020-07-08 Khaled Update README, Fix typo in install instructions 2020-07-05 Reini Urban encode: fix add_LibreDWG_APPID use-after-free set dirty_refs when we move the objects around. crashes 33, id: 0, when adding the LibreDWG_APPID triggered a realloc dxf: minor fixes wider format of group 90-99 fixup class->dxfname DATATABLE fix USCVP code to 65 (ODA bug, documented as 71) spec: fix r2000 MEASUREMENT section value RL_LE == 256 for 1 was wrong for dxf, decode and encode. dxf: optional PICKSTYLE, set TEMPLATE.MEASUREMENT from HEADER dxf: limit printed double precision similar to AutoCAD DXF Ascii output. At all 17 or 18 chars (18 if negative) dxf: handle color method c8 (none) => 257 travis: ASAN switch from clang to gcc (7.4) travis: switch from xenial to bionic travis: another ASAN try failed weirdly encode: fix fixup_BLOCKS_entities NULL deref with an Illegal BLOCK_HEADER.entities[] reset num_owned if wrong. fuzzer: crashes 32, id: 0 2020-07-05 Reini Urban EXPORT 4 major functions for dwgfuzz dwg_decode, dwg_encode, dat_read_stream and dat_read_file. They cannot be moved to dwg.h because of the internal Bit_Chain*, but are essential enough to be exported, and needed for dwgfuzz. Silence initialization warning for dwgfuzz mode. Exit if uninit 2020-07-04 Reini Urban add dwgfuzz check target dwgfuzz: add man page but not installed doc: add dwgfuzz item to examples improve dat_read_file fp must be open for fread already, but now we need not know the size before. if dat->size is empty, it is now filled. new examples/dwgfuzz for easier fuzzing, and debugging the three afl-clang-fuzz strategies: INMEM, STDIN or FILE. ~10x faster. STDIN fails still. dxf: add HEADER_RC0 for two optional header fields DIMFIT, DIMUNIT 2020-07-04 Reini Urban fuzz: improve to persistent shared-mem mode for dwgwrite with injson hardcoded (json import + dwg export), for dxf2dwg with indxf hardcoded, for dwgrewrite with dwg hardcoded. They ignore args now. 2020-07-03 Reini Urban indxf: forgot one add_TABLEGEOMETRY_Cell assert fuzzer 30, id:18 2020-07-02 Reini Urban api: rename DICTIONARY*.hard_owner to is_hardowner dxf: reorder and default VERTEX_2D dxf: reorder TEXT r2000+ dxf: reorder TEXT r13-r2000 2020-07-02 Reini Urban indxf: improve BL CONTROL overlarge num_entries fixup adjust wrong num_entries faster, which avoids DDOS attacks on overlarge numbers. esp. with BL types (layer, block, ...) Fixes fuzzer 29, id: 12, 29, 69, 80 hangs. 2020-07-02 Reini Urban indxf: protect from APPID_CONTROL....num_entries BS overflow several CONTROL tables have only BS num_entries, which lead to import hangs on overlarge (fuzzed) numbers. fuzzer 28, id:4, 6 hangs 2020-07-02 Reini Urban dynapi: add missing D2T support needed for indxf ATEXT fuzzer 28, id: 7 2020-07-02 Reini Urban indxf: Invalid ASSOCACTION.*param_names handle vectors and invalid num fields fuzzer 28, id:71 2020-07-02 Reini Urban indxf: Skip invalid postponed eed APPID check resolve_postponed_eed_ref field and code. fuzzer 28, id:3 indxf: fix wrong EED without matching 1000 pair fuzzer 30, id:0 (this is the new afl++ 2.65d with CFG instrumentation) indxf: fix 101 !Embedded Object hang handle 101 which is not Embedded Object hanged fuzzer 28, id:0 2020-07-02 Reini Urban indxf: fix AcDbEvalExpr hang on false pair need to seperate success from fail otherwise it will hand going into add_AcDbEvalExpr endlessly fuzzer 27, id:0 and probably many more. 2020-07-02 Reini Urban indxf: Invalid ASSOCACTION.deps[%d].is_soft DXF code fuzzer 29. id:75 2020-07-01 Reini Urban dxfwrite: INJSON unicode hack in_json is the only importer which still writes all strings as TV, not TU. (for valid perfofmance reasons, which we can only write r2000) dxfwrite is currently the only which tries to write TU, which came up with the new empty CUSTOMPROPERTY strings, which is only one byte long, not two. support version macros in the section specs 2020-07-01 Reini Urban dxf: add CUSTOMPROPERTY in DXF header from SummaryInfo. Rename key to tag. add HEADER_VALUE_TU0 helper (not if empty) 2020-07-01 Reini Urban add Auxheader support for r2004+ change AUXHEADER.maint_version* from RS to RL. changed with r2017 2020-06-30 Reini Urban finish AcDbPointCloudObj more AcDbPointCloudObj objects add debuging POINTCLOUD doc: LibreDWG.info too large was automatically split into two 2020-06-30 Reini Urban decode: protect r2000 last_handle as with r2004. dwg_decode_add_object could have failed, so 0-1 would be invalid fuzzer 15, id:149 2020-06-30 Reini Urban logging: avoid fprintf overflow on non terminated buffer FIELD_TFF on acis_data does nto guarantee NULL-termination in its logger. fuzzer 15, id:110 2020-06-29 Reini Urban decode: skip INVALIDTYPE objects which don't have a name nor dxfname. Dont add those. Fixes fuzzer 14, id: 217 2020-06-29 Reini Urban indxf: dont accept DXF 0 fields which would be parent 0, and setting parent to some random value is certainly wrong. fuzzer 27, id: 476 2020-06-29 Reini Urban regen-dynapi: fixup #line's indxf: protect wrong 3dsolid again now the 350 history_id. fuzzer 27, id: 469 indexf: protect empty 2 name skip it then fuzzer 27, id: 463 indxf: check empty 3DSOLID 1 encr lines fuzzer 27, id: 447 indxf: add generic CHK_array() should cover all array access now indxf: oops, forgot more asserts indxf: protect from invalid 3DSOLID fuzzer 27, id: 417 gen-dynapi: normalize topdir without inspecting it. indxf: exit AcDbEvalExpr with code 0 fuzzer 27, id: 415 indxf: more NULL deref protections fuzzer 27, id: 394, 408, 418 afl-fuzz: add some funcs dwgwrite needs some api functions which are excluded from afl-fuzz. NEWS for the 0.11 release indxf: protected all asserts Fixes GH #187 All asserts (array bounds checks) are now protected by explicit range and NULL checks. 2020-06-29 Reini Urban bits overflow: bisect mingw64 failure mingw64 started failing between decode: error earlier on wrong obj->size some fuzzing cases at 6 are just unrepairable. 0.10.1.3507 smoke/dxf 431a9826 https://ci.appveyor.com/project/rurban/libredwg/builds/33538209 decode: error earlier on overflow when obj->size is too large some fuzzing cases at 6 are just inrepairable. 0.10.1.3506 smoke/dxf 40c2cb70 which is only the added overflow checks in bits. 2020-06-29 Reini Urban indxf: CELLSTYLE NULL deref fuzzer crashes27, id:424 indxf: remove more asserts MULTILEADER_leaders, MULTILEADER_lines. More bounds checks. fuzzer crashes27, id:417 indxf: remove more asserts HATCH, MLINE. More bounds checks. the fuzzer likes to crash on those asserts. crashes27, id:349 indxf: fix plotsettings.2dpt crash when fuzzing 27, id 348 travis: asan is now at 16min, re-add check-minimal and programs and fix the check-minimal syntax 2020-06-28 Reini Urban Merge branch 'dynblocks' finish BLOCK*PARAMETER fields add missing BLOCK*GRIP fields apply changed BLOCKPARAMETER_PropInfo and add BLOCKXYPARAMETER fields refactor BLOCK*PTPARAMETER subclasses 2020-06-27 Reini Urban fix BlockAction DWG order compared to DXF forgot about BlockActionWithBasePt for BLOCKSCALEACTION and BLOCKROTATEACTION. This explains the conn_pts offsets unit-testing: fix CHK_ENTITY_HV for NULL hdls. such as in BLOCKSTRETCHACTION rename AcDbBlockAction.ba_pt to display_location more BLOCKSTRETCHACTION but not yet done refactor Block*Action fields use 1-6 connection points add some Block*Action fields and tests also add a nice unit-testing check-debug target unit-testing: add some test files for the new dynblocks spec; disable broken SCALE Embedded Object for now see the work/impl branch spec: add BLOCKFLIPPARAMETER fields spec: BLOCKBASEPOINTPARAMETER fields travis: even longer asan timeouts add make -C test/unit-testing check-minimal Change some ConstraintParameter field names unit-testing: update-ignorance promote BLOCKGRIPLOCATIONCOMPONENT, BLOCKVISIBILITYGRIP to unstable BlockGrip fields 2020-06-26 Reini Urban bits: avoid wrong unknown buffer overflow warning fix BLOCKGRIPLOCATIONCOMPONENT crash Add a couple new dynblock objects generated unit-tests with a small perl script spec: promote VISIBILITYGRIPENTITY, VISIBILITYPARAMETERENTITY to DEBUGGING api: auto-generate dwg.h entity and object unions api: auto-generate the dwg_setup_NAME functions also in dwg.h. Closes GH #239 api: move dwg_setup_PERSUBENTMGR to debugging this broke the freecad python bindings. See #239 But we really should autogenerate these setup functions as the others. And let's move them to dwg_api.h rename AcDbObjectContextData in_dwg to has_xdic dxf: fix MTEXTOBJECTCONTEXTDATA rect_height order decode: add MTEXTOBJECTCONTEXTDATA.columns_type out of bounds check. some examples are corrupt, but long before. already with the points. unknown: fixup double-free rather leak some g[j].bytes make regen-unknown full-regen-unknown examples: update bd-unknown.inc examples: add EMPTY_CHAIN initializer I switched the fields around recently, which broke unknown. 2020-06-26 Reini Urban spec: improve HELIX also rename num_turns to turns, so that it shows up in JSON. It's a double, not just full turns. Update from SPLINE (could use define or subclass, but not so far) 2020-06-26 Reini Urban dxf: reorder IMAGEDEF spec: add UNDERLAY.clip_inverts improve DXF for WIPEOUT a bit. order of clip_mode and handles. spec: add INDEX object seen registered as App, even if I only seen that as subclass for LAYER_INDEX and SPATIAL_INDEX. api: add more Dwg_Version_Type enums These are all the versions ODA detects. Dont know for sure the Release names, but the 4byte magic are certain spec: add LARGE_RADIAL_DIMENSION spec: NURBSURFACE fields fails in the 3DSOLID part (missing AcDs SAB) spec: NAVISWORKSMODEL add flags spec: NAVISWORKSMODELDEF add flags api: MTEXT.is_not_annotative and fix some DXF fields: extents_* 2020-06-24 Reini Urban spec: harmonize MTEXTOBJECTCONTEXTDATA with MTEXT esp. its Embedded object spec spec: MTEXTATTRIBUTEOBJECTCONTEXTDATA fields analog to GEOPOSITIONMARKER dxf: missed the 70 invis_flag dxf: improve VERTEX_PFACE_FACE dxf values fix GEOPOSITIONMARKER DXF detector improve DXF, add the 101 marker. rename type to class_version (always 0) api: rename MTEXT.annotative to is_annotative and unknown_bit to unknown_b0 (always 0) fix the is_annotative r2018+ logic and the DXF codes. api: rename MTEXT.drawing_dir to flow_dir unit-test: disable ACSH_HISTORY_CLASS history_node it crashes there 2020-06-24 Reini Urban spec: more Constraints objects: ASSOCDIMDEPENDENCYBODY ASSOCPOINTREFACTIONPARAM, ASSOCEDGECHAMFERACTIONBODY, ASSOCEDGEFILLETACTIONBODY, ASSOCDIMDEPENDENCYBODY, subclasses: ASSOCEDGEPERSSUBENTID ASSOCINDEXPERSSUBENTID 2020-06-24 Reini Urban spec: add 4 missing ASSOCARRAYPARAMETERS objects all with the same structure, so should be typedef'ed such as REGION/BODY/3DSOLID, but I hate those exceptions. dxf: move MULTILEADER.ctx around in dxf before the leader. also fix dxf_CMC colors for 90+ 2020-06-23 Reini Urban indxf: wrong WIPEOUT.num_* overflow 12 > 12 ERROR indxf: TABLESTYLE asserts => errors geojson: normalize_polygon_orient for RFC7946. Polygons should follow the right-hand rule unit-tests: fix darwin scandir DT_DIR is only defined unless _POSIX_C_SOURCE or _DARWIN_C_SOURCE 2020-06-23 Reini Urban geojson: improve color support rgb truecolor strings now with '#' prefix, only with entity and truecolor methods. skip ByLayer, ByBlock colors. 2020-06-23 Reini Urban doc: Describe our GeoJSON format 2020-06-23 Reini Urban geojson: Dummy, fix the linters the last Dummy feature MUST have a geometry object, which MAY be null. https://tools.ietf.org/html/rfc7946#section-3.2 While we are here also make the properties object empty. 2020-06-23 Reini Urban geojson: fix Point arrays MTEXT, TEXT, INSERT elements had wrong Point arrays geojson: optional z in coordinates See https://tools.ietf.org/html/rfc7946#section-3.1.1 Altitude or elevation MAY be included as an optional third element. geojson: closed Polygon also for POLYLINE_2D MulitLineString was wrong. Either LineString if open, or Polygon if closed. MultiLineString would be for MLINE. geojson: skip Dummy? write last Dummy Feature only if we did not write a single feature before. Nope, this breaks JSON compat, as we need to known the last feature to end without comma. geojson: add support for closed Polygon 2020-06-23 Reini Urban geojson: move id to Feature, skip color ByLayer https://tools.ietf.org/html/rfc7946#section-3.2 If a Feature has a commonly used identifier, that identifier SHOULD be included as a member of the Feature object with the name "id", and the value of this member is either a JSON string or number. Keep property.EntityHandle value for the lastcomma quirks. 2020-06-23 Reini Urban add 2nd geojson-validation linter support as fallback for mapbox/geojsonhint add geojsonhint check which detected various errors in our geojson output 2020-06-22 Reini Urban dynapi: fix shadow warnings spec: whitespace only indxf: fix ASSOCACTION, ASSOCDEPENDENCY, PERSUBENTMGR fields indxf: protect from illegal ASSOCACTION.num_deps fuzzer 27, id:142 2007: defatalize some missing optional sections analog to r2004. Thanks to @zhengf312 with GH #236 api: add dwg_get_OBJECT and handle the few aliases (REGSION, BODY, XLINE, ...) also handle the lowercase shortened names. do if DEBUG indentation api: generate dwg_api.h lists automatically _3DFACE still manually, as the entity_name for these is without _ api: generate dwg_api.c lists automatically api: add missing _3DFACE, _3DSOLID api functions. Move Dwg_Entity_PROXY_LWPOLYLINE to a subclass. The entity is PROXY_ENTITY dynapi: simplify dwg.i generation abstract into out_clases, because we want to do the same for more files. bindings: fix list of classes in dwg.i 2020-06-21 Reini Urban Merge branch 'smoke/dxf' Most Constraints objects are now in. Just the final ASSOC2DCONSTRAINTGROUP misses the subent curve code. Some WIP commits in this branch broke compilation. 2020-06-21 Reini Urban add BLOCKPARAMDEPENDENCYBODY add more action params and bodies ARRAYITEMLOCATOR subclass, ASSOCACTIONPARAM, ASSOCVALUEDEPENDENCY, ASSOCARRAYACTIONBODY, ASSOCARRAYMODIFYACTIONBODY and a few more AC*CONSTRAINT subclasses add ASSOCRESTOREENTITYSTATEACTIONBODY demote failung ASSOCSWEPTSURFACEACTIONBODY 2020-06-20 Reini Urban add ASSOCMLEADERACTIONBODY add ASSOCEXTENDSURFACEACTIONBODY forgot one more refactor ASSOC2DCONSTRAINTGROUP with AcConstraintGroupNode add missing ASSOC*SURFACEACTIONBODY OFFSET and TRIM spec: add remaining ASSOC*DIMACTIONBODY spec: add ASSOCOBJECTACTIONPARAM spec: add ASSOCNETWORKSURFACEACTIONBODY like ASSOCPATCHSURFACEACTIONBODY promote ASSOCNETWORK to unstable spec: fix ASSOCNETWORK almost the same as ASSOCACTION, just a bit smaller. spec: fix AcDbAssocSurfaceActionBody it uses ASSOCACTIONBODY, not ASSOCACTIONPARAM, as the name already says. rename most ASSOCSURFACEACTIONBODY fields, now a subclass. api: export dwg_resbuf_value_type renamed from get_base_value_type. needed for dwggrep, because it is used in some public datatype AcDbEvalVariant. spec: promote ASSOCGEOMDEPENDENCY, ASSOCACTION to unstable actually it is stable already, just need to test in_dxf. assocaligneddimactionbody looks stable, but crashes. fix EvalVariant values dispatch on the DXF code AcDbValueParam protections but still crashes 2020-06-20 Reini Urban add ASSOCCOMPOUNDACTIONPARAM which is mostly a subclass for Path and OsnapRef, but exists as class also. and fix more unit-tests 2020-06-19 Reini Urban add ASSOCASMBODYACTIONPARAM fix new debug classes ASSOCACTIONPARAM et al unit-tests esp. ASSOCPARAMBASEDACTIONBODY macro add ASSOCFILLETSURFACEACTIONBODY and more refactoring add framework for AssocArrays spec: finish ASSOCACTIONPARAM refactor wip more ASSOCACTIONPARAM work 2020-06-18 Reini Urban spec: WIP more ASSOCACTION subclasses more embedded structs, which we need for indxf wip: some more assoc actions simplify ASSOCPATHBASEDSURFACEACTIONBODY all those have the same struct indxf: fixup ASSOCACTION (renames) indxf: fix empty 1001 code new fuzzer 26 testcase id:439 rename some ASSOCDEPENDENCY fields minor refactoring 2020-06-17 Reini Urban spec: add ASSOCVARIABLE debugging lots of assoc subclasses missing api: rename RASTERVARIABLES.display_* to image_* dxf: image re-orderings (minor) IMAGEDEF_REACTOR has a double 330 ownerhandle in out_dxf add more covered DXF names but just the class declarations, no objects unfortunat. looks like most are not filed to DWG. add missing unhandled decls VISIBILITYGRIPENTITY, VISIBILITYPARAMETERENTITY and re-sort api: promote ACSH_BOOLEAN_CLASS to stable enough coverage unit-tests: log stability adjust tests for --enable-debug dxf.test and json.test are now stable with --enable-debug Just acsh_history_class crashes indxf: support TABLESTYLE.sty.cellstyle and fix TABLESTYLE.name (not sty.name). Fixes DEBUG_CLASSES assertions on indxf spec: add debugging MPOLYGON which is a hatch plus boundary api: rename XRECORD.cloning_flags to cloning as with DICTIONARY. Add docs. dxf: VIEW r12 dxf order spec: replace PLOTVIEW table lookup by VIEW (6) There is no PLOTVIEW table, but the VIEW table. This was an oversight. unit-tests: fixup CHK_SUBCLASS_VECTOR_TYPE typos more C++ compat now just the in_dxf.h ADD_OBJECT/ENTITY calloc assignment is wrong. indxf: mingw gcc 9.2 -Wmaybe-uninitialized warning indxf: detect for more DWG magic earlier versions indxf: ioerror on too small input file fixes a new fuzzing crash, 26 id:299 indxf: fix unicode EED strings likewise but here we need to operate on the real string length, after conversion from UTF8 to UCS2. Also acccount the size for the added padding. injson: fix importing empty EED strings heap-overflow with memcpy on len=0 decode: fix EED unicode strings byte-swapped also add a padding byte to the eed_data struct, to match the ASCIIZ string, but esp. to allow reading unaligned 2byte values with ubsan. now it's aligned. injson: fix from_version mishmash extract importer version macros to importer.h there we need to look at from_version. for export (encoder, out_*) we need the target version dxf: fix 3DSOLID DXF output and encrypt_SAT1 wrong dxf codes for acis_empty/has_revison_guid wrong num_blocks wrong encryption. decode: fix invalid bitsize also r2007+ which did caused std_dat overflows in fuzzing 7, id:90 bits: add earlier read_CMC overflow checks some fuzzing 7 testcase id:90 keeps overflowing json: fix printing unicode EED strings off-by-one, missing the first character, and then byte swapped. decode: error earlier on wrong obj->size some fuzzing cases at 6 are just unrepairable. bits: more overflow protections for some special fuzzing cases with wrong obj->size. better check before some cases, to return earlier. decode: don't forget DWG_ERR_VALUEOUTOFBOUNDS when size overflowed, but was adjusted. indxf: ACSH.history_node.trans followed by 0 detected by fuzzing, crashes6, id 459 indxf: fix hang on wrong 2 CLASSES not followed by 0 CLASS. Fixes 2 crashes26 hangs error early indxf: protect CellStyle.orders[grid] overflow detected by fuzzing round 26. fixes all 7 crashes26 free: classes even with 0 num_classes fuzzer 26 indxf leaks simplify object_alias for ACDB_*OBJECTCONTEXTDATA_CLASS fix OCD_Dimension unit-tests add {DM,ORD,RA}DIMOBJECTCONTEXTDATA .gitignore: two more private dirs add ANGDIMOBJECTCONTEXTDATA spec: add AcDbDimensionObjectContextData and RADIMLGOBJECTCONTEXTDATA for large Radial Dimension ObjectContextData 2020-06-15 Reini Urban indxf: add_AcDbEvalExpr dxf: ACSH_HISTORY_CLASS different DXF order indxf: fix lshift problem with temp int keep the long type to be able to represent 0xc2 << 18 src/in_dxf.c:7457:37: runtime error: left shift of 194 by 24 places cannot be represented in type 'int' spec: 3DSOLID.revision_guid off-by-one not large enough. strlen is 38, not 37 indxf: 3DSOLID.revision_guid DXF 2 for r2013+ 2020-06-14 Reini Urban importer: abstract decode_BACKGROUND_type for decode, in_json, in_dxf. docs: more stability fixups spec: promote BACKGROUND to unstable spec: more BACKGROUND changes set type by dxfname on decode/import, add object_alias. looks even stable now spec: more seperate structs, enable BACKGROUND AcDbBlockGripExpr, BLOCKGRIPLOCATIONCOMPONENT BACKGROUND subclasses, now promoted to debugging spec: make a seperate evalexpr struct same as with history_node, to be able seperate the same DXF codes in in_dxf. dxf: added more 3DSOLID dxf codes to regen-dynapi. indxf: AcDbShHistoryNode support but AcDbEvalExpr really should be a struct/subclass, not inlined 2020-06-13 Reini Urban dwg.h: harmonize SWEEPOPTIONS_fields macro SweepOptions_FIELDS is different to all other header macros. _fields needs to be all lowercase, and to seperate it from the specs macros make the name all UPPERCASE. unit-testing: simplify test_code call travis: shorter asan skip unit-tests, always reaching the 50min hard limit now api: stabilize most ACSH classes just 5 are unfinished, and 6 are a bit unstable. TODO: indxf of the trans vector_n1, and some subclass specifics 2020-06-12 Reini Urban test-data: add coverage dwg for some ACSH classes to be able to put them into stable. unit-testing: improve CHK_ACSH_HISTORYNODE trans matrix spec: a bit AcDbEvalExpr comments and rename one field. This is a single node in the EVALUATION_GRAPH spec: more ASSOCPERSUBENTMANAGER but not much. still missing the subent structure. spec: more ACSH subtypes finish material and color acis subclasses. yet unused. spec: add ACSH_CONE and CYLINDER classes this should be all ACIS History_Node classes now, I think 2020-06-12 Reini Urban spec: add ACSH_BOOLEAN_CLASS and rename EvalExpr.ee_class_version to ee_int the default is -1, a signed int32. Not in DXF. It could be a nodeid, but then it would be in DXF. 2020-06-12 Reini Urban spec: ACSH classes major/minor, fix unit-tests abstract EvalExpr and HistoryNode subclasses spec: add AcDbShHistory to ACSH_HISTORY_CLASS 2020-06-12 Reini Urban Unify 3DSOLID layout, extend AcDbEvalExpr ensure all 3DSOLID objects have the same layout (one is an object, not an entity). implement the AcDbEvalExpr fields, and use it. Not as extra struct as history_node, just inline it. A history_node is an seldom used extension, the evalexpr is a major feature (and already used) AcDbEvalExpr really should have the values as union, but does not work yet. Try later. 2020-06-12 Reini Urban add dwg_add_handleref_free for non-global free'able handlerefs 2020-06-12 Reini Urban ACIS 2: fix order of applied entities we need to shift from the beginning, not from the end. we need to use the same order of entities and SAB streams. also clear acis_empty on converted acds acis_data, otherwise it will be skipped. 2020-06-12 Reini Urban ACIS 2: Fix SAB stream detection r2013+ r2013+ uses a new End-of-ASM-data marker, deviating from ACIS. They forked it to ShapeManager afterall. This new marker is only used in AcDs streams ACIS 2: assign r2013+ 3DSOLID sab data store the handles when seeing them globally, in acds.spec assigne them directly one after the other, assuming the order is the same in both. fix one -Wformat - nonliteral fix memmem decl freebsd and macos fail on memmem calls, probably due to a missing decl. relying on _GNU_SOURCE is fragile for a non-GNU libc header. The only regression is a -Wdedundant-decl warning. We really should check the header for it, not just the library. api: export dwg_encrypt_SAT1, dwg_convert_SAB_to_SAT1 Better this way. Move dwg_encrypt_SAT1 to a place not affected by --disable-write, as it is now also needed by out_dxf for r2013+ 3DSOLIDs. api: add dwg_obj_is_3dsolid which is needed when we read the AcDs section after the OBJECTS, and need to assign the acis_sab_data[] to 3dsolid entities. ACIS 2: scan the AcDs data for ACIS and store them globally, to be picked up later. ACIS 2: change v2 to num_blocks = 1 only rather add newlines, not now blocks for each line. This is counterprodutive and different to the v1 format 2020-06-12 Reini Urban ACIS 2: class-specific boolean strings finally found some 1996 ACIS documentation, which I collected then (as ps). add and fix some tags, this is now almost complete, just enums not yet also fix a couple of overflows, allocate enough. 2020-06-12 Reini Urban ACIS 2: final encryption for the DXF v1 ACIS 2: convert_SAB_to_encrypted_SAT abstractions No errors anymore. 2020-06-10 Reini Urban WIP ACIS 2: convert_SAB_to_encrypted_SAT with Bit_Chain This way all the underflow checks are done automatically. And we can use the simplier bit_read/write functions, instead of sprintf. Found a couple new opcodes, and a documentation for the header and indices. No opcode docs yet. 2020-06-10 Reini Urban WIP ACIS 2: dxf needs convert_SAB_to_encrypted_SAT dxf without AcDs just converts the SAB to an encrypted ASCII SAT. SAB looks pretty easy to decipher. A very primitive format, and I even found my own stdlib documentation which I wrote 1998. spec: add ACSH_BREP_CLASS A simple AcDbShPrimitive with 3DSOLID Prepare NEWS for 0.11 2020-06-09 Reini Urban extend 3dsolid unit-tests travis: start the slowest tests first so that the overall time goes down ACIS 2: add encode and json support split the acis_data lines into 2. first the readable magic to identify it, the rest as binary (hex) 2020-06-08 Reini Urban add HAVE_MEMMEM, implement workaround A naive O(n^2) variant, but good enough for us ACIS 2: read the whole SAB and then try to find the "End of ACIS data" marker for the size. This is without has_ds_data, e.g. 2004. 2020-06-08 Reini Urban api: minor MULTILEADER B renames neg_textdir, text_extended -> is_ prefix abstract CMLContent_fields common fields for the Content union add calc. type field to check at run-time. .h formatting (clang-format) 2020-06-08 Reini Urban unit-tests: simplify some checks more vector macros, applied to multileader. catch more nan's 2020-06-07 Reini Urban automake distcleancheck for the info came back despite info-in-builddir add FCFOBJECTCONTEXTDATA decls fix more debugging unit-tests fix arc_dimension unit-test looks stable now. need to check the importers still. add CONTEXTDATAMANAGER class and re-enable OBJECTCONTEXTDATA api: rename VIEW.pspace_flag to is_pspace 2020-06-07 Reini Urban fix CALL_SUBENT types but still disabled. dynamic dispatch on an entity changed to hold a handleref, not an object 2020-06-07 Reini Urban ACSH unit-tests new ACSH decls spec: more ACSH entities TODO: need CALL_ENTITY by dynamic int type, not static by NAME. Some kind of dwg_##action##_dispatch_private(). 2020-06-06 Reini Urban regen-dynapi: fix RTEXT.extrusion dxf json: fix PROXY_OBJECT binary data and data_size json: add missing PROXY_OBJECT which fixes the empty json object {}. esp. for r13, which has many such proxies STYLE: comments only swig: silence wrong swig cpp parser error warning 305 "DWG_TYPE_POLYLINE_2D = 0x0f," is a valid enum line, and not a #define bla = num statement api: next is a perl keyword rename ResBuf.next to nextrb indxf: fix -Wmaybe-uninitialized mode warning in add_CellStyle api: from is a python keyword rename MESH.edges.from to idxfrom, "to" to idxto api: self is a python keyword rename MATERIAL.gentextures.self to material C++: template is a C++ keyword MLEADER_Content union changed: fix unit-test 2020-06-06 Reini Urban Enable C++ compat To compile with g++/clang++ reserved keywords, inner structs, malloc casts, ... Needed for some bindings in C++ 2020-06-06 Reini Urban deocde: fix preR13 TABLE offsets can read now again older files, partially .gitignore: add bindings/gambas/ will be a submodule eventually needs to be compiled in the gambas sourcetree, not here. i.e. copy it over, not symlink. 2020-06-06 Reini Urban spec: fix whitespace add comments of broken fields. fix RTEXT.extrusion dxf detection. lost the 210, needs to be on a seperate line. Fixes a 5645c0ce00b120491c9bf6c771d3de87b119cb9d regression 2020-06-05 Reini Urban unit-testing: rm duplicate tests spec: aesthetics indxf: support point vectors, get array numfields allocate and set point vectors generically. only dxf 10-19 indxf: PLOTSETTINGS indentation only 2020-06-05 Reini Urban fix gen-dynapi for spec define _fields copy the DXF and ENT fields over. got many missing dynapi DXF values. improve EXTRUDEDSURFACE more (dxf vs dwg) 2020-06-05 Reini Urban spec: abstract common SweepOptions more NULL ptr protections failing with the new testcase LiveSection1. NULL blk->name add 2018/LiveSection1.dwg for livesection coverage in the unit-tests promote DETAILVIEWSTYLE to unstable just indxf missing spec: fix DETAILVIEWSTYLE analog to SECTIONVIEWSTYLE promote SECTIONVIEWSTYLE to unstable indxf missing spec: fix SECTIONVIEWSTYLE looks stable, just indxf is missing. SECTION_SETTINGS: promote to unstable add to the unit-test spec: more SECTION_SETTINGS default hatch_pattern to SOLID (if empty) add bit_set_T api to convert from ASCII to T. fixup the unit test 2020-06-04 Reini Urban SECTION_SETTINGS refactor multiple types and geometry settings in fact. for all max 4 types, if activated (2d, 3d, and for both live on/off) 2020-06-03 Reini Urban indxf: fix DIMASSOC crash unit-testing: dont test DEBUG_CLASSES to speed up asan testing mostly SECTIONOBJECT: promote to stable SECTION_MANAGER: promote to stable fix and add DXF codes encode: fix -Wmaybe-uninitialized warning SECTIONOBJECT: fix alpha type, rename settings handle ASSOCPERSSUBENTMANAGER: try the BL vectors 2020-06-03 Reini Urban api: move PERSUBENTMGR back to debugging totally unstable. need to find out about CALL_SUBENTITY first (dispatch_private via objects.inc-like list or a functable) 2020-06-03 Reini Urban spec: even more PERSUBENTMGR this is a frozen repr of ASSOCPERSSUBENTMANAGER with two BL vectors spec: more PERSUBENTMGR the last BL is an array of BL 2020-06-02 Reini Urban dxf: some DICTIONARY keys are always hard 360 ACAD_SORTENTS, ACAD_FILTER and SPATIAL are always hard. also fix the RC hard_owner version checks, starts already with r13c3. travis: 2x asan make check timeout (10 -> 20 min) encode: add bit_chain_init_dat helper to set opts and versions. move fh to the end of the struct, used the least. encode: refactor dwg_encode_eed, part 3 fix the flush logic a bit. there are mult. data lines for each handle/size. optimize bit_copy_chain do memcpy on byte-aligned target. 2020-06-01 Reini Urban encode: refactor dwg_encode_eed, part 2 add bit_copy_chain. remove size checks, we write the size at the end encode: refactor dwg_encode_eed on need_recalc split the out stream into two, let _data return the size, and copy the 2nd data stream. 2020-05-31 Reini Urban travis: -fno-var-tracking for asan it is expensive, maybe it helps Revert "travis: try gcc for asan" This reverts commit 96233ad611e752efa7efa24ece3a8039206e033e. gcc 5.4 asan does not obey env ASAN_OPTIONS (indxf leaks) bit_embed_TU_size: support UBSAN and fix the len argument, which was offbyone encode: convert EED strings from/to unicode free: fix in_json created_by leak we dont currently store that string in the Dwg_Data struct. gcc on travis detected that leak, my gcc 9.3 not (it's static so not really a leak), travis clang neither. travis: try gcc for asan clang is extremely slow 2020-05-30 Reini Urban api: harmonize VIEW fields with VPORT/VIEWPORT s,target,view_target, s,center,VIEWCTR, s,width,view_width, s,height,VIEWSIZE, harmonize entity VIEWPORT SNAPANG r2006 logic with object VPORT 2020-05-30 Reini Urban api: even more VIEW/VIEWPORT changes all the HEADER value overrides in its special *Active tables: s,ucs_per_viewport,UCSVP s,ucs_orthoview_type,UCSORTHOVIEW, s,grid_spacing,GRIDUNIT, s,snap_spacing,SNAPUNIT, s,snap_angle,SNAPANG, s,snap_base,SNAPBASE, s,view_height,VIEWSIZE, 2020-05-30 Reini Urban api: more VIEW/VIEWPORT changes s,view_direction,VIEWDIR, s,view_center,VIEWCTR, s,view_twist,twist_angle, s,{front,back}_clip{,_dist},\1_clip_z, also SPATIAL_FILTER.*_clip_z 2020-05-30 Reini Urban api: VPORT changes check for R_2006/AC1020 just for VPORT.SNAPANG only in this version VPORT is different. rename VPORT.viewwidth to view_width fixup the DXF order a bit. 2020-05-29 Reini Urban major api changes for UCS, VIEWPORT, VIEW another mass rename, for consistency: s,orthographic_view_type,ucs_orthoview_type, s,ucs_ortho_view_type,ucs_orthoview_type, s,ucs_orthografic_type,ucs_orthoview_type, s,ucs_origin,ucsorg, s,ucs_x_axis,ucsxdir, s,ucs_y_axis,ucsydir, VIEW.camera_plottable => VIEW.is_camera_plottable {VIEW,UCS}.x_direction => ucsxdir {VIEW,UCS}.x_direction => ucsxdir {VIEW,UCS}.elevation => ucs_elevation 2020-05-29 Reini Urban spec: minor dxf: sort LAYOUT dxf fields dxf: XRECORD.cloning_flags 280 are optional api: add two more versions, R_2_4 and R13c3 for which we have now DWGs. encode: fix some wrong old header.dwg_version values (also see common.c) logs-all.sh: add test/test-old files with two nested dirs spec: refactor VPORT_ENTITY_HEADER thanks to the old dwgs dxf: UCS some optional fields spec: fix STYLE no direct ttf_ fields, just in xdata. might need some kind of xdata stream handler: FIELD_XDATA_CLASS ("ACAD", 1001) FIELD_XDATA (ttf_typeface, T, 1000) FIELD_XDATA (ttf_flags, RL, 1071) add 2013/gh44-error.dwg for SPATIAL_FILTER coverage otherwise it cannot be stable spec: SPATIAL_INDEX is unstable refactor api: SPATIAL_FILTER changes rename some fields. add and fix unit-test spec: improve SORTENTSTABLE dxf has pairs of handles, not 2 vectors. dwg seperates the two streams. spec: simplify SCALE travis: make check also times out with ASAN 2020-05-28 Reini Urban dxf: APPID simplify, use FIELD_RC0 undocumented, not in ODA, but as DXF 71 in the wild, for ADE_PROJECTION injson: support embedded entity classes, not just subclasses for PLOTSETTINGS, embedded into LAYOUT. indxf: add generic subclass code only used for LAYOUT.plotsettings for now, but is generic enough for all subclasses. embed PLOTSETTINGS into LAYOUT it is the very same. promote PLOTSETTINGS to stable remove PLOTSETTINGS.page_setup_name, it was a mixup. 2020-05-27 Reini Urban LAYOUT, PLOTSETTINGS: api changes rename a lot of fields. PLOTSETTINGS really is a parent of LAYOUT. indxf: more derefered handles like our layer handles, which are not read yet, if in DXF by name. TODO: check VIEW, VIEWPORT handles. LAYER: add visualstyle field r2013+ travis: asan times out again at unit-testing add a unit-testing check-prep target and add a seperate timeout for that. 2020-05-26 Reini Urban spec: promote CELLSTYLEMAP to stable indxf: more add_CellStyle fields CELLSTYLEMAP becomes now a stable candidate, joining TABLEGEOMETRY log: extend to test-old files which are two dirs deep indxf: use add_CellStyle for CELLSTYLEMAP not for the other TABLE objects yet spec: promote LAYERFILTER to stable spec: promote LAYERFILTER to unstable found an example 2020-05-25 Reini Urban GEODATA: promote to stable, add indxf code indxf catched GEODATA before checking the dxf codes, so we can intercept the arrays to allocate them. If not belonging to the 2 arrays, pass the pair along to the generic search. spec: more GEODATA improvements 2d points are generally 2RD, not 2BD. looks stable now 2020-05-24 Reini Urban indxf: fix MLINE segparms and areafillparms make it independent on the order of the 72 and 73 DXF fields. indxf: 4 more HATCH gradient fields unit-testing: fix a visualstyle signedness dynapi_test: skip wrong ovr.name test ovr.name is not a known fields, we would need to test for the subclass instead, as in the unit-test. so skip it. crashes on travis, but not at home MLEADERSTYLE fails dynapi_test via decode class_version is 2, but via dynapi_test it is 0 on example_2018. The reason is that we picked up a wrong ./example_2018.dwg spec: whitespace only 2020-05-23 Reini Urban DIMASSOC: minor changes intsectobj[] is a H*. Still WIP. Also fix json SUB_HANDLE_VECTOR 2020-05-22 Reini Urban make VISUALSTYLE.display_brightness_bl signed apparently there is a double value of -50.0 VISUALSTYLE: fix ubsan error -50 is outside the range of representable values of type unsigned int, for the double->uint conversion of display_brightness indxf: fix null deref, Out of memory checks fix free for lt. union since 1d2f5c7b5d3e1becc8b5b499632b6ef6cf0120ce we follow both version branches, so the MLINESTYLE.lt.ltype union has a wrong pointer, which crashes on free when following it. seperate the values. injson: add more Out of memory checks facebook infer complains. also it found some dead assignments bits: add more Out of memory checks facebook infer complains. It is right injson: refactor _set_struct_field search keys at first, then process the result. remove dead code now handled in _set_struct_field. 2020-05-21 Reini Urban injson: search all keys for valid embedded structs not just the very first. injson: trace the current subclass (name) not just the key, ie fieldname. the name is now also used for subclass field lookup for embedded structs, so fixup the MLEADER subclass names also. injson: skip wrong Out of memory error when the binary string is just empty "". also log add the name.key, esp for recursive subclasses. json: fix FIELD_2RD_VECTOR indentation e.g. clip_verts .gitignore: vscode, more tests dynapi: fix TABLESTYLE.ovr.name ovr.name is an invalid C variable name. use ovr_name instead. spec: add SUB_FIELD_HANDLE0 for TABLE.cell.text_style optional handle 344 injson: support primitive inlined structs as CellStyle, MATERIAL_color and such. When the key was not found, check for the . and recurse into the remainder. 2020-05-20 Reini Urban TABLE unit-test fixups TABLE_value fixups spec: TABLE_AttrDef* spec: more work on TABLE. add SUB_FIELD_CAST 2020-05-19 Reini Urban TABLECONTENT: more dxf markers and one more truecolor field: indicator_color ditto CMTC for TABLESTYLE move TABLESTYLE back to debugging r2010+ is wrong still TABLESTYLE: add overrides r2010+ just an idea, but fixes the leaks injson: improve json_binary no extra str allocation, no unicode quote detection and conversion injson: please valgrind Uninitialized memory in stack strings. comments only json: strip key[rcount*] from CMC CELLSTYLEMAP.cells[rcount1].cellstyle.bg_color CELLSTYLEMAP: enable, promote to unstable 2020-05-16 Reini Urban TABLESTYLE: more 2010 work and rename some more fields api: rename some TABLESTYLE structs more according to the DXF subclasses. TABLESTYLE_Cell => TABLESTYLE_CellStyle BorderStyle => GridFormat spec: TABLESTYLE, merge with CELLSTYLEMAP support for r2007+, add sty.cellstyle unknown: regen with B::cstring quote for illegal strings in the C .inc files, caused by foreign encodings (ANSI_1251 e.g.). We'd really need to decode these properly. 2020-05-15 Reini Urban api: add R_1_3 version see the file magic database spec: fix MLEADERSTYLE.class_version 2 no extra is_new_format field, just class_version 1 (not in DWG) or 2. it is the code 70 value from EED ACAD_MLEADERVER. One new fields text_angle_type is class_version 2 only dynapi_test_all.sh: fix test-data dir 2020-05-15 Michal Josef Špaček Fix 1.4 version DWG magic for this version is "AC1.40", not "AC1.4". 2020-05-14 Reini Urban configure: missed a comma broken with -fno-common spec: normalize_BE HATCH.extrusion.z and for indxf LWPOLYLINE.extrusion 2020-05-14 Reini Urban spec: work on HATCH rename some fields: type_status => curve_type solid_fill => is_solid_fill annotative => is_annotative the bitvalues of HATCH.paths.flag 2020-05-14 Reini Urban bits: normalize extrusion.z, fix write_BT for <=R_14 the extrusion vector needs to be normalized. early thickness has no B (default bit) extend 3DSOLID unit-tests spec: 3DSOLID.wires.color is BL r2004* not BS spec: add 3DSOLID r2013+ revision guid in DXF as 2 {} guid in DWG as BL, BS, BS and TFFx 8 2020-05-13 Reini Urban spec: add 3DSOLID r2007+ materials dxf-check: MULTILEADER is now stable 2020-05-13 Reini Urban unit-testing: final manual CHK_ fixups api: rename all insertion_point to insertion_pt, also TABLE fields and dwg_api funcs. rename all dwg_api 3DSOLID num_isolines functions to isolines 2020-05-13 Reini Urban unit-testing: simplify CHK_ENTITY_H and 23RD perl -i -p -e's/CHK_(.+), (\w+), \2\);/CHK_\1, \2);/' test/unit-testing/*.c unit-testing: simplify CHK_ENTITY_TYPE perl has backtracking regexp, elisp not. perl -i -p -e's/CHK_(.+), (\w+), ([A-Z0-3]+), \2\);/CHK_\1, \2, \3);/' test/unit-testing/*.c unit-testing: simplify CHK macros dedup the value arg DIMENSION_ANG2LN: fix def_pt keep the type as 3BD, but read/write only 2D. Just json (and dxf) needs the real type. DXF with z. dxf_test: ARC_DIMENSION fixes wrong names in the .inc file ditto for DIMENSION_ANG2LN merge arc_def_pt with def_pt 2020-05-12 Reini Urban ARC_DIMENSION: merge arc_pt with def_pt 10 only use the default name spec: promote MULTILEADER to stable spec: stabilize MULTILEADER wrong arrowheads.is_default type rename attach_type to text_aligment, the prev. text_alignment is the angletype indxf: rename cur_vstyle var to prev_vstyle unit-tests: add SINCE/PRE version macros some versions have wider types spec: promote VISUALSTYLE to stable 2020-05-11 Reini Urban indxf: support r2010+ VISUALSTYLE group 176 fields Revert "spec: remove LAYER_TABLE_FLAGS special-case" This reverts commit a51939c7bba5d91f8f1f724845b800f7bee94a8c. unit-testing: RS flag use RC instead (the layer exception) 2020-05-11 Reini Urban spec: VISUALSTYLE r2013+ support rename some fields (again) flip some wrong fields add r2013+ version 3 layout with its 58 props (yet unknown field names) 2020-05-11 Reini Urban spec: MLEADERSTYLE add r2013+ and rename some B fields spec: add FCFOBJECTCONTEXTDATA debugging 2020-05-10 Reini Urban api: rename DIMENSION_ANG3PT.first_arc_pt to center_pt bits: fix TIMEBLL julian fraction calculation. it's millisecs since midnight, not secs. api: rename LAYER_INDEX.timestamp to last_updated it is a cache indxf: add TIMEBLL support for LAYER_INDEX.timestamp spec: re-add LAYER_INDEX.timestamp reverts 39ff601a7b261eb74182b04255802e56bd82c41a add LAYER_entry support to indxf. indxf: change to DIMENSION_LINEAR on 50 also dim_rotation has the subclass marker after 50, not before. outdxf: bulges are optional fix assert spec: promote VBA_PROJECT from debugging to stable 2 fields only write2004: limit compression to MIN_COMPRESSED_SECTION size of 19 and assert it. switch the compressed flag before. write2004: more compress_R2004_section work more work on it, the lz77-like encoder. the reverse part of the decompressor. enable now all functions. 2020-05-09 Reini Urban free: fix CMC double-free from injson CMC was static there, keeping the previous name/book_names pointers. encode: trace SUB_FIELD_CMC values dxfb: add optional BL0, ... variants dxf: add FIELD_T0 optional text, only print to DXF if not empty free: fix TABLESTYLE leaks 2020-05-09 Reini Urban CMC: improve in_dxf and in_json detect book_name from $, otherwise set only the name, plus its proper flag. TODO alpha/alpha_type only for ENC. Maybe seperate CMC from ENC (different flag, alpha) 2020-05-09 Reini Urban CMC: fixup color.index by palette lookup needed for DXF. for the DWG we need to write 0 as index for truecolors CMC: better diagnostics print dwg_color_method_name of the known methods bit_read_CMC: add more snaity checks fixup invalid method, invalid flag actions: add more _private functions with the end goal to also call free on them gcc10: add -fno-common explicitly we are safe due to windows compat already. but for older compilers ensure it. spec: more DIMASSOC_Ref work TABLESTYLE r2010+ support spec: avoid -Wduplicate-branches warning on non-dxf actions both bodies are empty, leading to this warning. regen-unknown with updated field names 2020-05-09 Reini Urban api: rename ext_line_rotation and _13,14_pt in TEXT,ATTDEF,ATTRIB,STYLE and DIMENSION_ALIGNED, DIMENSION_LINEAR, DIMENSION_ANG3PT oblique => oblique_angle oblique_ang => oblique_angle ext_line_rotation => oblique_angle _13_pt => xline1_pt _14_pt => xline2_pt 2020-05-08 Reini Urban spec: use calling _private: GEOPOSITIONMARKER -> MTEXT and some more. fix DIMASSOC spec types. more GEOMPOSITIONMARKER fixes. add unhandled COMPOUNDOBJECT. 2020-05-07 Reini Urban spec: DATATABLE spec WIP. roughly, but looks good. spec: use callable subclass for MAT_TEXTURE WIP spec: callable subclasses embed the calling of subclasses into a function wrapper, so that it can call itself or others. needed for recursive procedural MATERIAL.MAT_TEXTURE calls. 2004: fix some -Wnull-dereference in encode detected by the new gcc with -O2 dxf: improve CMC truecolors always set method 0xc2 when reading rgb 420. allow a hypothetical truecolor DIMSTYLE.DIMTFILL. don't write non 0xc2 truecolors with DXF, just the index 62. fix in_json leaks, we do assign the color names now. dxf: CMC.color optional esp. to skip DIMSTYLE.DIMTFILL 428 0 and such. TODO: with method c2 we should emit truecolor black nevertheless 2020-05-07 Reini Urban dxf: const some read-only args add const dwg to common_entity_handle_data.spec const the dxf ent and _obj args for the common_entity_*data.spec output must not change the objects. protect those write areas with ifdef's, DECODER {} is not good enough. the compiler shouts, rightfully so. 2020-05-07 Reini Urban dxf: oops, enforce -y we rather ignored it dxf.test: fix roundtrip tests skip all unstable entities dxf.test: improve check_subentity diagnostics when the hardowner 330 value changed, display it with the code, not just the changed value. otherwise we won't know which field changed. spec: add BLOCKVISIBILITYGRIP move BLOCKGRIPLOCATIONCOMPONENT to debugging I am having a rough idea fixup debugging unit-tests 2020-05-07 Reini Urban spec: add BLOCKVISIBILITYPARAMETER and friends BLOCKVISIBILITYPARAMETER as debugging, BLOCKGRIPLOCATIONCOMPONENT, VISIBILITYGRIPENTITY, VISIBILITYPARAMETERENTITY unhandled. 2020-05-07 Reini Urban spec: improve DIMENSION_ANG2LN fix the spec rename pt fields (not in the old dwg_api) spec: more DATALINK fields examples: update unstable.pm status ARC_DIMENSION: promote to unstable fields do look good now spec: add ARC_DIMENSION still debugging encode: improve add_LibreDWG_APPID error handling spec: DBCOLOR is just a normal CMC color spec: BLKREFOBJECTCONTEXTDATA spec: more permissive CMC colors 2020-05-07 Reini Urban spec: rewrite CMC colors the first byte of the rgb is some method/flag. 0xc0 for ByLayer 0xc2 for entities, with names with an additional name flag RC, 0xc3 for truecolor, 0xc5 for foreground color, ... fix DWG and DXF methods. the 2nd dxf2 is not needed, it is always the same offset from 420. 2020-05-05 Reini Urban injson: fix wrong overflow at very last json_binary padding in AcDs spec: add CELLSTYLE dxf hints and fix some logic. some structs are optional. dynapi: fix set CMC injson: improve overflow error handling dont return, provide label targets so we can fix dwg->num_objects, to strip later objects, but keep the good ones. excess objects lead to invalid Handleoffset 0, sorted to the front, leading to early dwgread errors. 2020-05-05 Reini Urban decode r2010+: avoid bogus bit_advance_position warnings when we have no strings, and set the size to 0 first advance and then restrict 2020-05-05 Reini Urban spec: change COMMON_TABLE xref layout for r2007+. cross-tested with examples which do import xrefs. a major change. UCS: add orthopts undocumented, but in DXF and DWG api,spec: rename xref COMMON_TABLE_FLAGS, null_handle => xref rename SymbolTableRecord with xref xrefref => is_xref_ref xrefindex_plus1 => is_xref_resolved xrefdep => is_xref_dep extref and null_handle => xref spec: remove LAYER_TABLE_FLAGS special-case which is only relevant pre-r13 also spec: cosmetics api: rename OBJECT.xdic_missing_flag to is_xdic_missing get_bmp: there is a 3rd PNG type TODO: dwgbmp: add a flag to extract WMF and PNG 2020-05-05 Reini Urban API: rename most fields in STYLE, add 2 new rename fixed_height to text_size. *font_name to font_file. (it includes the extension) shape_file to is_shape (SHX) vertical to is_vertical add 2 BL fields; ttf_flags, typeface 2020-05-05 Reini Urban promote MATERIAL back to unstable importers are missing fixup layer_index.c unit-test fixup ATEXT.color_index => color dxf: skip if 0: BL0, BD0 injson: ignore MATERIAL.num_transmatrix error it does not exist 2020-05-02 Reini Urban MATERIAL: use structs for color, mapper and textures. This works now fine for all add RTEXT also expresstools ent, DEBUGGING so far, but looks ok also change TOLERANCE.text_string and TABLE_Cell.text_string to text_value. 2020-05-01 Reini Urban finish ATEXT, promote to debugging the fields do look ok spec: start with ATEXT WIP spec: improve GEODATA, LIGHT clean up GEODATA a bit. enable PhotoMetric LIGHT (web IES specs) abstract OBJECTCONTEXTDATA and ANNOTSCALEOBJECTCONTEXTDATA subclasses. spec: fixup PLOTSETTINGS some type changes. esp. 2 handles are text. rename PLOTSETTINGS.plot_layout to flags (i.e. a bitmask) add RENDERENTRY and unhandled BACKGROUND I know the various BACKGROUND types, but not yet how to select them fix CURVEPATH, add POINTPATH promote the 3 *RENDERSETTINGS to unstable found most field names, fix the remaining type withs. SUN: now unstable add CURVEPATH object minor VISYALSTYLE type improvements 2020-05-01 Reini Urban api: rename dwg_find_dicthandle it really does something else. rename to dwg_find_dicthandle_objname improve dwg_variable_dict to use the new dwg_find_dicthandle, finding a dicthandle by name. add unused wcs2cmp to compare two wcs2 strings. cache the value of LIGHTINGUNITS for the LIGHTS.is_photometric check 2020-05-01 Reini Urban spec: fixup LIGHT, LIGHTLIST, 3DSOLID, add 3 more add MOTIONPATH, RENDERSETTINGS and TVDEVICEPROPERTIES halfway debugging. rename has_ds_binary_data to has_ds_data. simplify LAYER_INDEX, add handle to struct. add str_dat to CMC color, WIP 2020-04-27 Reini Urban LIGHTLIST: promote to unstable LIGHTLIST: use a struct LIGHTSLIST: the text-handle vector but it really is a DICTIONARY add NURBSURFACE entity DEBUGGING only no coverage 2020-04-25 Reini Urban write2004: more compression work fix write_long_compression_offset write2004: move R2004_Header to last we need to set some values, and it is encrypted. write2004: set System Map section[].address 2020-04-25 Reini Urban write2004: needed to add section_info_rebuild when we invalidate all info->sections pointers by realloc Delete duplicate "empty R2004 slack" and unneeded Unknown Section 128-256: it is the encrypted R2004_Header section. 2020-04-25 Reini Urban write2004: rename back to SECTION_UNKNOWN fix SECTION_INFO SECTION_SYSTEM_MAP order, we missed SECTION_INFO. Init both. Reformat fixup the r2044_header info_id and map_id indices. we already added those to the sections. UNKNOWN[0] is compressed, not encrypted. 2020-04-24 Reini Urban write2004: write info and system_map sections before. Also into temp sec_dat buffers. They are compressed. Handle them as all other sections, so move some code around. write2004: add more type checks write2004: pre-alloc sections and info info->num_sections is easily calculated. so there is no need for realloc in the loop write2004: cleanup the sections a bit wrong types, indices. init sections before, analog to r2000 2020-04-23 Reini Urban bits: much smaller initial dat sizes from file or stream we set it in d*_read_file/stream already. for encode we mostly have small streams and only one big one. write2004: re-sort the sections EMPTY is now at 0 (as in the stream). type the sections to catch evtl. missing ones. writes2004: encrypt the sections as we already do with the R2004_Header. write2004: sort the section maps They have another sort order. Not by type, and not by stream order. api: rename FILEHEADER.rl_28_80 to r2004_header_address and dump some empty slack bytes for verification write2004: the section info map WIP move section_max_decomp_size to decode decode_test complains, as usual write2004: start with compress_R2004_section a simple LZ77 variant write2004: start writing the sections in stream_order. WIP decode: fix wrong Skip section %s with max decompression size with 2007-2010 Preview eg. write2004: add more section map helpers dwg_section_name (dwg, id) _max_decomp_size (which is version specific) section_compressed write2004: work on compress_R2004_section wrote 2 of 3 write helpers, the reverse of the read funcs HATCH comments for type_status/edge_type 2020-04-21 Reini Urban write2004: disable some wrong asserts r2004 starts writing with fresh streams. write2004: add bit_chain_set_version initialize the section streams. did have dat->version R_INVALID write2004: write Section Page Map at last WIP write2004: init the sections bits: add missing bit_write_TU?{16,32} funcs for the additional sections encode the r2004 sections WIP dwgrewrite: keep reading partially written files when using --as=r2004 and failing with SECTIONNOTFOUND in encode, i.e. halfway written files in the write2004 work rw: support --as=r2004 as the others. here we actually need it. write2004: add uncompressed compress_R2004_section (unused) we'll leave compression to later 2020-04-21 Reini Urban r2004_header: revert field_ID_string back to string part of 9169fae084413a28b535b0477c0e7e4aabf18e8f strings are easier to check than hex. encode the system sections map (no info yet) 2020-04-21 Reini Urban dwg_bmp: fix overwriting into r2004_header setting thumbnail->version wrote into the next struct r2004_header. A thumbnail was only a dwg.h Dwg_Chain without those Bit_Chain version fields. Change dwg_bmp to copy the contents of thumbnail into a proper Bit_Chain, without destructive sideffects. This really fixes the problems encountered in the previous commit. 2020-04-21 Reini Urban r2004_header: change file_ID_string and padding to binary avoid \uxxxx encoding issues with fixed size buffers. write2004: simplify dwg->r2004_header access 2020-04-20 Reini Urban ename R2004_Header.num_ fields injson skips num_, so rename them to num extract Dwg_R2004_Header for pack(1) clang -Wdouble-promotion dwg.in: enable --as=r2004 to test encode as r2004. analog to dxf check r2004_file_header encryption error against known AcFssFcA file_ID_string 2020-04-20 Reini Urban share and simplify decrypt_R2004_header its symetric, so can be reused for encode also. add a pack(1) to the struct Dwg_R2004_Header, analog to eed. it is easier to caclculate the crc32 this way. No need to write the R2004 File Header temporarily. 2020-04-20 Reini Urban encode: fix r2004 File Header crc32 calculation. wrong algo, wrong size. also log the encrypted header, to check the encyption encoder. looks right, as it's only xor with some one-time pad. write2004: encrypt r2004_file_header dwg_section_page_checksum implemented calculated section_checksum seed/offset/size by brute-force. WIP dwg_section_page_checksum add r2004_file_header.crc32 check (TODO) move dwg_section_page_checksum to decode testcases/decode_test failed with clang section: add dwg_section_page_checksum check for the first r2004_header.checksum, according to ODA p.27 Section page checksum of the System section page. TODO windows: move exported functions from common to dwg public functions need to be public, not private, esp. for windows. the problem is mostly decode_test, including common.lo for some private functions, clashing with these ones. 2020-04-19 Reini Urban api: remove unused header.is_tu we encode everything to TU on version >= r2007+ now doc: 2007 EED string has no codepage. more programs documentation export dwg_version_type useful for all sort of helpers dwg.c: resolve refs in iterators not always do we have ref->obj, eg. on in_dxf or in_json out_dxf: handle class T types dxf.in: handle non-dwg extensions thats why we have dxfwrite in_dxf: handle class T types encode: handle class T types dxfname is always there though injson: more wstring cases classes, eed (WIP). fixup version handling See GH #230. So far we only targetted DWG r2000, but we also need to write DXF, and there we can create all versions. So remove various hardcoded version = R_2000 assignments, and handle the from_version/version when reading it from the FILEHEADER (dwg, dxf, json). json has json_wstring, but use it consistently: classes, xdata, eed. dwg_block_control: create dwg->block_control copy if not existing. E.g. when importing from JSON and exporting to DXF. dxfwrite: simplify injson: less unneeded overflow checks esp. it errored on the very last FIELD_RL zero_8 2020-04-19 Reini Urban add programs dxfwrite create DXF from DWG, JSON or other DXF (or binary). Highly experimental. I wanted to create debugging SECTIONOBJECT's and such by myself easier, via JSON and then to DXF. Needs some work still. 2020-04-19 Reini Urban dxf.in: enhance to more input formats not just dwg. also json, dxf, dxfb. analog to the dwg helper. on intermediate dwg format we need to pass --as=rxxxx 2020-04-17 Reini Urban encode: enhance more OVERFLOW_CHECKs on array <-> size mismatches MESH: 3DPOINT* is handled by in_json 3BD* not. the vertex numfield was num_owned, special-case that. Fix encode OVERFLOW_NULL_CHECK_LV for empty array only error when the num_field was not empty. Emoty 3DPOINT arrays are allowed. promote MESH to stable enabling it as DXF entity all dxf_test's pass MESH: promote to unstable works for all my examples, and simple enough. decode: fix FIELD_3DPOINT_VECTOR for 0 points 0 point vectors are valid spec: fix some COMMON_3DSOLID parent warnings cast to the base parent type. for now only with -DDEBUG_CLASSES with the *SURFACE subtypes MESH: fix some types test-dxf.sh: adjust for one-level outoftree builddir tail -n2 log in helpers harmonize dwgread with dwgwrite to display the error status lines at the very end, not before free. Let the helpers display it. 2020-04-16 Reini Urban injson: reject old json format for DICTIONARY it is too much of a hassle to synch both arrays. most fuzzing errors and crashes are only because of this. json: simplify DICTIONARY.items map See GH #228 indxf: fixup DIMSTYLE.flag and similar for LWPOLYLINE and VPORT_ENTITY_HEADER. The other LWPOLYLINE.flag settings are done in new_LWPOLYLINE. json,dxf: enhance timeout to 30s testing larger drawings rename PLOTSETTINGS.shade_plot_id to shadeplot DEBUGGING only 2020-04-16 Reini Urban add missing VIEWPORT handles detected by cmp-objs.pl add more in_dxf handle codes to write if different to a soft pointer 5. 2020-04-15 Reini Urban encode: don't recalc bitsize for UNKNOWN bits even for INJSON. We rather dump the unknown_bits asis. MLEADRSTYLE: preserve is_new_format for indxf and json fixes MLEADERSTYLE dxf errors. formatting unit-testing: skip next_entity traversal got broken somehow, looping stabilize VPORT_ENTITY_HEADER 2000/plan.dwg e.g. had an viewports overflow. check for it beforehand. bits: improve wcs2* for ubsan and HAVE_ALIGNED_ACCESS_REQUIRED even if such processors don't exist anymore. ubsan is too picky. bits: improve wcs2* for NATIVE_WCHAR2 (Windows) where we can use the native libc. 2020-04-15 Reini Urban spec: change VPORT_ENTITY_HEADER.viewport to H* viewports we have a null-delimited list (delim by 5.0.0). This is still not binary eq as the original. The original stores 5.0.0 asis, we store it now as NULL HDL. But Teigha does the same. 2020-04-15 Reini Urban spec: rename VPORT_ENTITY_HEADER.vport_entity to .viewport it links to a VIEWPORT entity afterall spec: add extref to VPORT_ENTITY_HEADER fix dxf and dxfb 3dsolid also analog to encode and json in 9f45b00f08f03eae4844ac2847bff279c5ef05c4 fix encode and injson 3dsolid we forgot to write the last block_size[1] of 0. Abstract COMMON_3DSOLID, which was missing for all actions but decode and free. json: rename 3DSOLID.num_isolines to isolines it is not a REPEAT counter, it needs to be preserved in json. it looks like it is calculated from the acis_data. TODO DXF 2020-04-14 Reini Urban spec: found subclass for VPORT_ENTITY, VX it is relevant only for out_dxf 2020-04-14 Reini Urban fix bit_read_RC and bit_advance_position overflow checks when reading the very last byte of a stream, as e.g. in LTYPE.extref it incorrectly and silently returned 0, where it should be allowed to set the new position at the very end. Just subsequent reads should fail. Fixes the LTYPE import error from #225, detected with the new cmp-objs.pl No fuzzer regressions. 2020-04-14 Reini Urban json: fix xdicobjhandle, reactors for CONTROL objects add cmp-objs.pl: compare binaries via xxd check all binary differences of all objects, from the original logfile to the created logfile. e.g. after dxf-check or json-check 2020-04-13 Reini Urban dxf: fix 1002 and 1000 EED codes 1002 is either { or } 1000 needs to check if TU 2020-04-13 Reini Urban dxf: fix LTYPE.dashes.text 9 types pointing into the strings_area for the text to be repeated. Also avoid NULL text fields to be printed as "(null)". 2020-04-13 Reini Urban dxf: fix LTYPE order for 40 and dashes api: rename dwg_add_OBJECT to dwg_setup_OBJECT and setup its type if static. The variable type from the class is currently setup seperately. See dwg_encode_get_class 2020-04-13 Reini Urban encode: fix UNKNOWN_OBJ hdlpos certain versions (json 2000, dwg 2000) do write the UNKNOWN_OBJ asis. ensure that we don't write the comon handles twice. See DWG_OBJECT_END Also ensure that UNKNOWN_ENT doesn't overwrite a good bitsize. 2020-04-13 Reini Urban dwg: only one env ASAN_OPTIONS=detect_leaks=0 if you convert many DXFs more encode_unknown_as_dummy fixups set_handle_size of the generated APPID fix free problems by improving the dwg_add_OBJECT API accounting for imported objects (INJSON, INDXF) 2020-04-12 Reini Urban encode: refactor ENCODE_UNKNOWN_AS_DUMMY, do it upfront because we need to change APPID_CONTROL, which was already written by then. We also fixup the NOD earlier, before we have written anything. encode: use PLACEHOLDER if exists for UNKNOWN_OBJ and prepare APPID.LibreDWG (not yet enabled) DIMSTYLE: rename extref_handle to extref for consistency 2020-04-12 Reini Urban encode LTYPE: fix ownerhandle, xdicobjhandle. obj_flush_hdlstream 1st problem was in the Flush handle stream logic. We need to save first the COMMON handles, like ownerhandle, ... and then afterwards the accumulated hdl_dat special handles. 2nd problems was that we didn't reset the hdl stream to write into dat. Fixes the LTYPE part of GH #225 Also fix the bitsize calc logging to be relative to obj. 2020-04-12 Reini Urban LTYPE: rename and move extref_handle with dashes.style extref needs to be before. There are still some unhandled non-bull bytes at the end 2020-04-11 Reini Urban encode: rather remove_NOD_item ACAD even complains with a NOD item linking to a DICT, which has no link to a disabled object. ACAD removes this item, so do we. encode: add fixup_NOD to disable links to not-existing (unstable) objects/styles api: rename PERSSUBENTMANAGER to PERSUBENTMGR this is the name used in the NOD (named object dictionary) indxf: fix more ownerhandle abs vs rel issues less exceptions: All entities are relative. indxf: fix BLOCK_HEADER.first_entity eWrongObjectType Fixes this from GH #225 Reading handle 1F object type AcDbBlockTableRecord Error 34 (eWrongObjectType) Object discarded indxf: fix DIMSTYLE.morehandles type Fixes this Reading handle A object type AcDbDimStyleTable Error 34 (eWrongObjectType) Object discarded Missing AcDbDimStyleTable from GH #225 2020-04-10 Reini Urban add_DUMMY_eed: add unknown_bits as chunks of code 4, which has a maxlen of 255 2020-04-10 Reini Urban encode: add_DUMMY_eed when importing from a different version, save the old name in the DUMMY/POINT eed as code 0. Maybe save under a new LibreDWG APPID, and save the unknown_bits also. 2020-04-10 Reini Urban bits_test: align the strings at bit 0 so we can check and print it directly 2020-04-10 Reini Urban encode: xdata twice on size mismatch Closes GH #224. Teigha throws no XRecord errors anymore. We could also try to just patch the xdata_size BL, but this is easiest and does not much harm. There are no other side-effects than encode was re-using the space for converted texts. don't do that anymore. 2020-04-10 Reini Urban encode: calculate xdata_size on imports On imports we cannot trust the xdata_size, or we dont even have it. Remaining problem is that we already wrote the xdata_size BL before. See GH #224. log: use a bashism to support log file overrides e.g. ./log -lexample_2000.log.orig example_2000 dxf: change CMC with 90-99 dxf codes then emit/parse only the rgb part, not the index (which is 0 or 256) see e.g. MULTILEADER colors. unknown: fix field names regression @avail was exhausted via find_name(). re-fill it for every object, to find again names for all subsequent objects. which is needed for dxf_test and picat 2020-04-09 Reini Urban indxf: overflow checks also in json_fixed_key fuzzing 24: id 22 stable LIGHT, remove OBJECTCONTEXTDATA OBJECTCONTEXTDATA is only a subclass. LIGHT loooks good now, and there are a couple of examples. It's also an entity, and we don't want them to converted to a POINT. dxf_test: fix degrees (deg2rad) e.g. LIGHT stabilize LIGHT fixed now all examples. all unit-tests pass, just not DXF color.index. but this is broken for all CMC. bindings: update dwg.i (manually) rename DOCUMENTOPTIONS back to CSACDOCUMENTOPTIONS but still debugging delete all ACDSSCOPE comments it was ACMESCOPE afterall promote SECTION_MANAGER to unstable and sort the api decls add SECTION_MANAGER and SECTION_SETTINGS objects change SECTIONOBJECT to unstable looks good api: rename SECTION to SECTIONOBJECT and document some fields 2020-04-08 Reini Urban add unhandled ACSH_PYRAMID_CLASS 2020-04-08 Reini Urban dwg_free_variable_no_class switch make it a function jumptable. so we won't stump onto more optimizer bugs with extensive if (type) stmnts: MESH, SECTION, NAVISWORKSMODEL not defined as free. At least dwg_free_MESH.isra.0 appears now in `nm free.o` 2020-04-08 Reini Urban spec: remove duplicate DWG_ENTITY (SECTION) but harmless, was in #if 0 distcheck: clean LibreDWG.info and .pdf now that we build it properly encode: fix injson obj->size and also its CRC. The size starts after the size and ends before the CRC. dwg_bmp: reset dat->byte we advance dwg->thumbnail.byte to the start of the bmp, skipping the header. But when re-reading or writing it, we need to reset it. Fixes esp. dwgrewrite. travis: enhance make encode.lo also runs into a timeout also. add rw helper: dwgrewrite 2020-04-08 Reini Urban distcheck: failed to write to info don't know how to enable am__skip_mode_fix. but info-in-builddir works now. let's see if it breaks bsd make. requires automake 1.14 though. it might fix GH #211 2020-04-08 Reini Urban SECTION: rename geomsetting handle and add unit-test vector macros extend .gitignore I am missing too many new files. lets be stricter and sort it better. regen-unknown with new testcase LiveSection_2018 but no new entities yet. will try again later. acds: found another freesp segment type in the wild add NAVISWORKSMODEL, DEBUGGING only no coverage, only detected in the DXF documentation. undocumented in the ODA. In DXF as COORDINATION_MODEL add SECTION entity, DEBUGGING only no coverage, only detected in the DXF documentation. undocumented in the ODA. It might be ptr of VIEW.livesection 334 2020-04-07 Reini Urban bits: add more overflow checks with a macro. Fixes fuzzing crashes15, id 121 indxf: special r14 PROXY_ENTITY dxf groups a bit different VIEW: wrong center dxf code 20 it is 10,20 indxf: skip more unhandled DXF fields esp. with 2018, for stable objects indxf: LAYER misses color 420 in its fields do it manually indxf: fatalize ERROR: Unknown DXF for stable objects to abort on structurally broken DXF's, as with fuzzing. Before we ignored indxf errors. AcDs: protect from empty num_segidx fuzzers doing their thing 2020-04-06 Reini Urban indxf: error on Unknown DXF code on stable objects but not fatal so far, just complain loudly. SPLINE: let indxf create points not fitting the scenario. They are ignored. TODO free them, but we are having leaks in indxf all over. indxf: protect SPLINE array ptrs regressions: indxf-crashes4: id 95, 5: 40, 3: 101 add precise bit_read_bits to protect from rare heap-overflows in decode_unknown, when reading the very last byte. now we read the avail. bits precisely. Fixes a fuzzer regression with a new object. afl-fuzz: disable LOG at all afl-fuzz: avoid costly branch checks by disabling logging centrally encode: fix heap overflow on overlage size memmove fuzzing crashes24, id 13 encode: fix some NULL ptr derefs fixes fuzzing crashes24: 0-8 and 2 regressions at crashes18 at the same location. also the 23 regression. injson: more JSON_TOKENS_CHECK_OVERFLOW_ERR fixes fuzzing regressions 20: id 182, 328 23: id 79 but not the new cases 24. json: fix shellcheck violation protect from redefining FORMAT_BD by in_dxf.h affected was only dwg.c, in_dxf_.c, dwgwrite.c appveyor: copy libssp-0.dll to zip See GH #220, #218, #103, #166 json.test: shellcheck wants some {} grouping, na dxf_test: add --big only test slow test-big/ DWGs with --big not via make check, needs too much time. sortentstable: ents[i] may be NULL 2020-04-06 Reini Urban move fixup_BLOCK_HEADER to decode.c in in_dxf.c it was skipped for --disable-write but used in several read-only programs (e.g. dwgread). rename from-postprocess_entity_linkedlist to dwg_fixup_BLOCKS_entities. thanks to .travis.yml first task, finding linker errors with --disable-write also fix -Wmaybe-uninitialized warnings for rcount3. 2020-04-05 Reini Urban encode: enable ENCODE_UNKNOWN_AS_DUMMY to check both features, old and new PROXY: fix data_numbits for r14 and encode from DXF r14 has no restricted dat stream yet, DXF has no numbits field, so align it. Which is ok, because we control the stream start, and set bitsize accordingly. injson: fix json_advance_unknown once again. looks good now though injson: add json_vector helper, array of primitives encode: disabling POINT/DUMMY does not help neither work on PROXY OBJECT/ENTITY also fix bit_read_H is_global, and stabilize it on overflows. detected with the new PROXY loop in unit tests with certain DWGs encode: convert UNKNOWN_ENT to POINT To preserve the next_entity chain on unhandled entities, like LIGHT, HELIX, MULTILEADER, TABLE, SURFACE, ARC_DIMENSION, GEOPOSITIONMAKRKER, MESH. 2020-04-05 Reini Urban encode: convert UNKNOWN_* to DUMMY when the version differs. Then we cannot use the unknown_bits. maybe we should add an EED with the previous data then (type, bits) The biggest problem with this breaking the next_entity chain on unhandled entities, like LIGHT, HELIX, MULTILEADER, TABLE, SURFACE, ARC_DIMENSION, GEOPOSITIONMAKRKER, MESH, RTEXT. Maybe convert there to a POINT or PROXY_ENTITY instead. 2020-04-05 Reini Urban 3DSOLID: add missing COMMON_ENTITY_HANDLE_DATA which mostly was missing xdicobjhandle on encode injson: fix json_advance_unknown an object has an additional key upfront dxf: postpone linewt 370 to after ltype 6 which is in a different file, common_entity_handle_data.spec dxf: skip duplicate color 62 first for the index (if 0 ByBlock) second for the RGB flag, which is wrong dxf: entmode 67 1 when in paperspace dxf: skip duplicate TABLE ownerhandle 330 appeared twice for LAYER. Already done in DWG_OBJECT. Ditto for _XDICOBJHANDLE, but this was a wrong comment only. 2020-04-05 Reini Urban indxf: add_to_BLOCK_HEADER instead of postprocess_BLOCK_HEADER, we do it for every new entity adding it to entities, and setting the 4 handles. Now only out_dxf is wrong Closes GH #222 2020-04-05 Reini Urban postprocess_entity_linkedlist: log unicode BLOCK_HEADER names injson, indxf: always set the hashmap on the initial code 0 handles. This helps with subsequent handle searches dwg: default to .json and .dxf, not .dwg dwg,dxf: default to -y it is annoying, and we always overwrite while testing refactor Handle, add is_global flag greatly simplifies free, avoids leaks and double-frees add postprocess_entity_linkedlist GH #221 targetting r2000, our only write format, we need to convert all entity arrays (like BLOCK_HEADER) to a linked list of entities, via prev and next_entity. 2020-04-05 Reini Urban decode: loosen invalid handlemap offset fixup With a lot of deleted objects the "Invalid handleoff" warning might be bogus, max_handle (hash size) might be too small yet. Plus the offset fixup relied on a wrong calculation of the previous size. The CRC is included in the size. While we are here, just warn and dont fixup the offset, in my case from a good value to a broken one. Fixes example_2007-2010 json roundtrip 2020-04-05 Reini Urban encode: fix FIELD_VECTOR_T on unicode conversion boundaries. Use bit_write_T for down and up conversion. e.g. DICTIONARY.texts[] encode: convert xdata TU/TV so far we only converted FIELD_T types, xdata had a length (like TF) but really are strings dwg: skip msan leaks with dwg (to dwg) GH #151 dxf/json.test: harden the roundtrip checks with json also check the number of objects (Unstable ignored in dxf). improve the helpers and diagnostics 2020-04-05 Reini Urban dxf: fix SPLINE.flag from scenario write proper DXF 70 flag. indxf scenario from this flag (mask 32). improve DSYMUTIL on non-macOS 2020-04-05 Reini Urban dxf: fix SPLINE flags 1024 does not describe the scenario, only if there are fit_pts does. 2020-04-05 Reini Urban encode: loose write_DD eq-check check for fabs < 1e-12, so that some strtold dxf values are suddenly as equal as native. Fixes the example_2000/2004 LWPOLYLINE size overflow problem, which needed to memmove the whole object by 2 to make room for a 2nd MS RS. 2020-04-05 Reini Urban dwggrep: add --tables, search objects, refactor previously we only search BLOCK_HEADER and its entities. now also search all objects. Support --tables (only table names) Support --blocks (all block deifnitions) Add many missing objects dwg2SVG: support -m --mspace default to paperspace and count the printed entities there. if none are printed, fall back to modelspace. With -m ignore paperspace. dxf: use get_next_owned_block_entity for ENTITIES to keep the same linked-list order for <=r2000 api: add dwg_next_entity on r2000 follow the next_entity handle linked list. This may jump around in some cases. 2020-04-05 Reini Urban dxf: more r2000 BLOCKS fixes WIP revert most of c18a040e960e301c2afd3c0c1a3cc05f934c6814 the r2000 logic was wrong, last_entity may be far behind the endblk_entity. rather follow the next_entity chain until the last_entity. change get_next_owned_block_entity from inserts to entites (r2004+). oops. missing: one LWPOLYLINE MS size overflow one wrong SPLINE scenario. 2020-04-05 Reini Urban dxf.test: make roundtrip failures fatal fix the dxf.test roundtrip test: Unstable entities are skipped on out_dxf, we cannot count them. (LIGHT|MULTILEADER|UNKNOWN_ENT) the last remaining errors are: * wrong DIMENSION types, the previous change did more damage than good. * one LWPOLYLINE MS size overflow, * one wrong SPLINE scenario. See GH #219 2020-04-05 Reini Urban encode: fix overlarge size memmove before bit_write_MS an overlarge obj->size writes two RS instead of one. so move by 2, and enlarge the 2 sizes by two bytes. Same for the other direction, if an overlarge entity becomes smaller. See entity LWPOLYLINE 75A with 3695 points in example_2000 2020-04-03 Reini Urban AcDs: json fixes 2020-04-02 Reini Urban add/fix AcDs_SchemaData AcDs: more DXF prep AcDsProtype => AcDS as in DXF we need to keep those names for long, so go with the proper names. DXF already uses ACDS* not prototype. It is also shorter AcDsProtoype: harmonize the names a bit but not more. It will be eventually be AcDs aka datastorage, and the protype will be gone. let's what happens in r2021. extend AcDsProtoype.segments with all the subclass decls. but not parsed yet 2020-04-02 Reini Urban start with optional r2004+ AcDsProtoype_1b datastorage section which does contain the ACIS SAB v2 data. See ODA p.252, 24 Section AcDb:AcDsPrototype_1b (DataStorage) The Signature section is unfortunately not documented 2020-04-02 Reini Urban improve common_entity_data.spec ENC + proxy add Dwg_Color.raw to seperate to computed index and flag (used only internally). Seperate between preview graphics 160 or proxydata 92. Add computed entity.preview_is_proxy to reflect that. Add obj->klass for each variable obj (to check for klass->is_zombie for now) We dont want to seperate ENC into its own type, as done in the savekov patch, because this does not scale. We do have spec files to support all our actions at once in one place. 2020-04-02 Reini Urban gen-dynapi: abstract embedded_struct also support embedded structs for ldata, tdata and fdata dxf: fix FIELDLIST subclass and num_fields 90 formatting only gen-dynapi: improve MULTILEADER and more embedded structs find more DXF codes for these. Detect the . in fields. . is no \w dxf-check: harmonize .dxf.err path to check for teigha errors. defer cat to last. cleanup resolve_postponed_object_refs diagnostics only, and remove dead (duplicate) code. travis: improve asan timeouts dxf: fixup ATTRIB, ATTDEF order cross tested against ACAD dxf: log table names on out_dxf 2020-04-02 Reini Urban dxf: more r2000 BLOCKS fixes WIP With r2000 some BLOCK_HEADER.first_entity and last_entity are unreliable, at least for the very last BLOCK. The first can be before, e.g. right the next after BLOCK_HEADER, and the real last can be far behind the last_entity. Rather check the ownerhandle of all entities. Change get_first_owned_entity and get_next_owned_block_entity to compare the ownerhandles with r13-r2000. See GH #219 2020-04-02 Reini Urban dxf: fix r2000 BLOCKS emit until last_entity, and dont skip ATTDEF and such. Fixes lost entities on dxf roundtrips add is_type_unstable_all, is_type_stable add --enable-release to distcheck and therefore the uploaded nightly tarball. fix an uninit error in unit-testing/dimension_linear travis: extend travis_wait for ASAN build complation of in_json.o needs longer than 10m distcheck: one more distcheck-hook attempt GH #211 still not fixed dxf.test: print missing rountrip entities quite a surprise no helper script timeouts with --enable-debug TODO/SKIP some failing --enable-debug tests dwgwrite -Ojson crashes with DEBUG_CLASSES still. failing at TABLECONTENT and CELLSTYLEMAP subclasses, in in_json. crashing with r2010+ at encode. add MENTALRAYRENDERSETTINGS to debugging I recently added unknown support for some test-big files, and therefore added coverage for MENTALRAYRENDERSETTINGS (2004/double_free_example). document DIMENSION.flag 70 indxf: revert DIMENSION type earlier It is wrong, just print the potention flag type 2020-03-30 Reini Urban indxf: fix DIMENSION type earlier via the flag 70, not the subclass, which might be too late. plus it is only optional. no dxf code for DIMENSION.ins_scale, fixes lspace_factor The subclass checker looks now obsolete (possible dead code), but for now leave it in. maybe check later with asserts. the testdata only shows flag 128, which is suspicious. 2020-03-30 Reini Urban DIMASSOC: document and unit test updates 2020-03-30 Reini Urban improve regen-unknown log not found $obj $hdl in $dxf when already past it (sorted by hex value) and skip the dxf. ~2x faster. and we missed out all directly subsequent objects. this fixes that. 2020-03-29 Reini Urban gcc-9.3.1 tested ok on fc31 x86_64 sudo dnf --enablerepo=updates-testing update gcc so adjust the compile-time warning. Not ok over at cperl XSConfig still, so let's be sceptical and alert. 2020-03-29 Reini Urban unknown: sort alldwg.inc by handle otherwise we cannot find previous handles in log_unknown_dxf.pl which skipped many interesting objects. bd-unknown.inc: skip uniq checks for the comments (GNU only?) only sort by some initial characters (with fixed width). skip imprecise (cut) results. rather check only precise found doubles, but check for RD and BD. 2020-03-29 Reini Urban make regen-unkown with added 2000/plan.dxf for the previous DIMASSOC change 2020-03-28 Reini Urban DIMASSOC: handle main_subent_type: 0 found some examples with main_subent_type 0 which does not have some subsequent fields. fixes 2000/plan and 2004/double_free_example encode: refactor and fix HANDLE_STREAM processing only flush when necessary, reset hdl_dat to ref of dat. copy only needed for the small buffer for DIMASSOC, ACAD_TABLE handles before. refactor and unify LOG_POS logging injson: read 3DSOLID fields json: split acis_data at newlines, as ARRAY json: write 3DSOLID fields TODO: split acis_data at newlines, as ARRAY. encode: fix obj->size, off by 2 we haven't written the CRC yet DEBUG_HERE_OBJ: avoid overflow at the end of the stream, with -v5 encode: seperate hdl_dat stream earlier as in decode, almost: write the common handles later on START_OBJECT_HANDLE_STREAM or when that is missing at DWG_OBJECT_END. no special cases for CONTROL objs needed here 2020-03-27 Reini Urban encode: allow writing bigger dat chunks allocate in a while loop, with abort() injson: skip useless DICTIONARY warnings Warning: Skip some itemhandles, only accept 21 of 21 indxf: add TABLEGEOMETRY support indxf is still a big bull of mud. dxf_test would be the proper way, like the generic in_json. But as we still don't have that many subclass loops to support, we can still tolerate it. promote TABLEGEOMETRY to stable found complicated coverage files, all ok. TODO in_dxf json: fix FileDepList end of object indices it's a mischmasch, but now it works with multiple array entries. at the end of each array loop advance the end-of-object index, at the end of each object advance it, at the end of each section back off. encode: decide between critical or skipping section errors on section address or size overflows only error critically on critical sections, not just some AcDb:Template error. set to 0 then json: fix structure error fatality if in some unimportant section like FileDepList a structure error occurs, dont fail critically with INVALIDDWG, just INVALIDTYPE. json: fix DIMASSOC hack and SORTENTSTABLE in some examples 2020-03-26 Reini Urban promote TABLEGEOMETRY to unstable doc ok, coverage fair, no errors so far unit-testing: improve TABLE improve TABLEGEOMETRY harmonize with TABLECONTENT. The main problem was an ODA bug for geometry.unknown 95 doc: update classes status make regen-unknown and split off a full-regen-unknown. mostly we can re-use the existing alldwg.inc, when we just change some fields in some objects add ASSOCGEOMDEPENDENCY fields add remaining unknown objects all those with dxf coverage: ACMECOMMANDHISTORY ACMESCOPE ACMESTATEMGR ACSH_HISTORY_CLASS ASSOCGEOMDEPENDENCY ASSOCOSNAPPOINTREFACTIONPARAM ASSOCVERTEXACTIONPARAM DOCUMENTOPTIONS RAPIDRTRENDERSETTINGS 2020-03-26 Reini Urban improve regen-unknown perf to 1m Don't linear search each handle in each dxf from the beginning again. In each dxf per obj the handles are sorted, just continue. time went down to 1m5s also remove a lof of unsorted handles, unneeded. 2020-03-26 Reini Urban improve LEADEROBJECTCONTEXTDATA more fields add 2 more debuging classes LAYERFILTER, LAYOUTPRINTCONFIG with poor coverage unknown: split up alldxf_1 by dxfname for easier editor handling. One big became just too big. add more MATERIAL fields to unknown to increase matching accuracy. 2020-03-25 Reini Urban add Dockerfile to EXTRA_DIST and add minor improvements: --enable-trace is default --enable-release is needed for production services using a git checkout, and not a release tarball. It skips invalid nan fields, ... 2020-03-25 yossefazoulay Dockerfile for libredwg with python3 base image for build and test Dockerfile for libredwg created CodeFactor validate Dockerfile for libredwg created Dockerfile for libredwg created 2020-03-25 Reini Urban json: change NOCOMMA logic to first special-case the first entry of an array/hash, as this is what we known beforehand. the first field prints no ",\n" at the start, all others do. This was an out-json.c TODO Closes GH #75 2020-03-25 Reini Urban WIP fix NOCOMMA hack also for json but here we need to use nested ISLAST/SETLAST/CLEARLAST checks. refactor VECTOR and REPEAT blocks for json. But with this attempt we'd need to mark all last fields, in each DWG_OBJECT. Better try the initial idea, as outlined in the comment: ISFIRST, ... 2020-03-25 Reini Urban fix json NOCOMMA hack for simple geojson when writing to stdout or a pipe. In this trivial case check all paths for is_last. For json we would need a flag in dat->opts. See GH #75, and an attempt at PR #213 2020-03-24 Reini Urban even more unknown fields we can now detect more switched fields of the same type. add more unknown fields with empty field text, unknown and dxf_test will not work add debugging SECTIONVIEWSTYLE very similar to DETAILVIEWSTYLE re-enable LAYERFILTER (unhandled) it does appear in DXF and DWG. Use this name, as it appears in the named object dict as ACAD_LAYERFILTER. add debugging DETAILVIEWSTYLE best .pi coverage > 90% and known fieldnames make regen-unknown The previous GH #214 init handles changes fixed DICTIONARYWDFLT handles and some DIMASSOC objects. No known regressions so far. CONTROL_HANDLE_STREAM: honor the r2007+ has_strings bit wrong HANDLE_STREAM overflow check, without honoring it. likewise in CONTROL_HANDLE_STREAM we cannot overwrite hdl_dat, which honored it. Fixes r2007+ issues with *_CONTROL objects, and related MLEADERSTYLE has_new_format logic, with off-by-one bit 2020-03-23 Reini Urban unit-testing: add NULL checks add CONTROL_HANDLE_STREAM exception there num_entries is before the handles, because with r14 we cannot init hdl_dat that early dxf: add eed the dxf_format logic is not correct for code - 1000. decode: extract common_object_handle_data.spec decode: init handle_stream earlier dxf_test: support subclass fields either extra malloced vectors (_obj->field[i]), or embedded with simple _obj offset also fix the dxf_test -a flag 2020-03-23 Reini Urban DIMASSOC: add num_mainobjs BS for mainobjs SUB_HANDLE_VECTOR not a single one. 2020-03-22 Reini Urban move DIMASSOC.ref.rotated_type 71 to DIMASSOC and the previous BS slot looks like a type or num_mainobjs 2020-03-21 Reini Urban dxf_test: handle wrong dxf codes check against the dynapi type on known mismatches restore DIMASSOC (is unstable) unknown: set some DIMASSOC field type hints where the dxf code is wrong, eg BS instead of B, and such. unknown: split pi files into chunks of max 50 goals otherwise we get nasty PICAT timeouts or even out-of-memory make regen-unknown for added UNKNOWN_BITS via LOG_TRACE_TF fix LOG_TRACE_TF, esp. for DECODE_UNKNOWN_BITS unknown did not catch most unknown_bits TF more DIMASSOC make regen-unknown for DIMASSOC dynapi: support SUB_FIELD_HANDLE dxf code extend DIMASSOC dwg.spec: REPEAT_BLOCK indent 4 harmonize some ASSOCACTION fields unit-testing: observed higher angles so angles are obviously not normalized when filed to DWG. some end_angles exceed 2*pi, so use 4*pi instead. 2020-03-20 Reini Urban unit-testing: silence some warnings when iterating over NULLHDL block entries e.g. unit-testing: fix subdir recursion big oops 2020-03-20 Reini Urban unit-testing: support -a and -an to show all results. for unit_testing_all.sh. fix LTEXEC path in unit_testing_all.sh, parallelize the initial make. 2020-03-20 Reini Urban make regen-unkown add debugging DATALINK almost good replace ANNOTSCALEOBJECTCONTEXTDATA with subtypes new BLKREF*, LEADER*, MLEADER*, MTEXT*, MTEXTATTRIBUTE*, TESTOBJECTCONTEXTDATA objects unit-testing: 50% dxf_test ok logging display only the first 6 objects per file. size went from 2924419 to 1315383. still mostly VISUALSTYLE configure: add -fno-semantic-interposition with gcc and --enable-shared (default). This disallows many LD_PRELOAD tricks. 2020-03-20 Reini Urban limit the travis log size The 4th distcheck failed because of it. Only log max 10 objects for dxf_test ok(), and max 6 objects with the individual unit tests. This shortened the unit-testing make check log size from 3771627 to 3678755. The complete log size was 6184698, mostly consisting of dxf_test VISUALSTYLE logging. Leave out make check with distcheck. 2020-03-20 Reini Urban add extra object ALDIMOBJECTCONTEXTDATA which has more fields than ANNOTSCALEOBJECTCONTEXTDATA (to which it previously resolved to) fix make regen-unknown more fixes for out-of-tree builds. skip all overlarge num_bits > 30000 (out of memory in picat). added a lot of new objects, detected a lot of more BD/RD values. add missing ASSOC*SURFACEACTIONBODY objects They could be just one object, but so far seperate them. They are so in DXF and as class, even if it looks like that they have the same fields. fix make regen-unknown dont trigger it by dependency with distcheck api: remove SURFACE type it is most likely either just a PLANESURFACE, or a generic type a la DIMENSION. rename unhandled (not persistent) LAYER_FILTER to LAYERFILTER and remove it as unhandled type, because it very likely not persistent to a DWG. maybe it is even LAYERFILTERS as in the central DICTIONARY_NAMED_OBJECT. fix unit-testing/check-objects.pl failures 2020-03-20 Reini Urban add unit-testing/check-objects.pl to check if all known objects have unit-tests. against generated src/objects.inc (make regen-dynapi) hereby we can ensure all the necessary dwg_api declarations and functions are not absent. 2020-03-19 Reini Urban minor LTYPE.dash spec rearrangement unit-testing: add all missing objects and the missing dwg_api types and funcs unit-test: limit ok() to max 10 objects else just be silent. In some DWG's we just have too many objects, like LINE, XRECORD, ... unit-testing: fix debugging surface --enable-debug only 2020-03-18 Reini Urban fix dxf_test unusual points some points do have DXF 46, ..., such as PLOTSETTINGS.plot_origin. Check our dynapi type instead api: fix missing EXPORT dwg_obj_mlinestyle_get_flag detected by the new unit tests unstable MULTILEADER: skip if wrong dxf_test: allow NULL strings fix examples/alldxf_0.inc paths for dxf_test. dynapi: fix NULL strings NULL converted to utf8 is also NULL, not an error. Fixes a couple of unit-tests. Also initialize the old API for wide strings. And add old API checks for some objects unit-tests: support obj with old API, and unicode text tests api: rename unimplemented dwg_obj_polyline_pface_get_points to dwg_ent_polyline_pface_get_points. deprecated, use the dynapi instead WIP SCALE.name r2007 problem This object has no has_strings bit. detected with the new unit-tests. unit-testing: revise coverage logic only process a new file, if: * there is no coverage yet, or * if the file is r2007 or r2018 (crossing unicode or latest) starting with 2000. Update test-data/example_2000.dwg with VIEW store a VIEW, to get unit-testing coverage unit-testing: improve coverage warning VIEW has no coverage 2020-03-17 Reini Urban unit-testing: add missing debugging objects unit-testing: add missing stable objects unit-testing: add unstable PERSSUBENTMANAGER add 2004/Surface.dwg/dxf, check dynapi unstable for ASSOCPERSSUBENTMANAGER coverage. dwg_getall_*: skip unneeded init unit-testing: add dimassoc (unstable) unit-testing: add assocperssubentmanager DEBUGGING unit-testing: add assocplanesurfaceactionbody promote ASSOCALIGNEDDIMACTIONBODY to unstable add unit-test unit-testing: add unstable assocdependency add classes.c/unknown.pm stability helpers get unstable/debugging/unhandled per name or type. convert type to name (e.g. for logging) strip dxf_test dependencies, move funcs around a bit move PLOTSETTINGS to unstable regen-unknown, with MULTILEADER added back. dynapi_test: relax unstable VISUALSTYLE lot of nan's dxf_test: support points e.g LIGHT 2020-03-16 Reini Urban free: avoid double dwg_free dxf_test: support env LIBREDWG_TRACE tracing. avoid double-free and use-after-free on broken DWGs dxf_test: fix dwgfile leak dxf_test: support CMC types ptr vs value dxf_test: add --class, --file args and don't calc the name alias twice unit-testing: add dbcolor which crashes in dxf_test disable dxf_test on --disable-write or -dxf unit-testing: TODO ARC_DIMENSION.user_text dxf_test: add needed objects unit-testing: add dxf_test compare against examples/alldxf_1.inc values from unknown. See GH #212 improve PLOTSETTINGS but only got coverage for 2013 improve VISUALSTYLE for r2010+ regen-unknown for changed API unit-testing: add max angle checks 2*pi for radians 2020-03-15 Reini Urban api: rename desc to description, ... VISUALSTYLE fixes for r2018, add and rename fields. add mlinestyle unit test json: fix CMC output in REPEAT loops i.e. CELLSTYLEMAP cells[rcount1].style.background_color spec: improve VISUALSTYLE some more stable fields without DEBUG_CLASSES 2020-03-14 Reini Urban rm AC_PROG_RANLIB rendered obsolete with LT_INIT indxf: check SPLINE.scenario in_dxf: fix strdup(dxfname) leaks autoscan, check for HAVE_SCANDIR add proper autoconf probes scan-build: fix dead assignments scan-build: store in srcdir fix dwg_find_dicthandle NULL deref found via scan-build unit-testing: extend mline, fix leak 2020-03-14 Reini Urban unit-testing: support a dir arg scan all DWGs in all subdirs. speeds up unit_testing_all.sh. But not on mingw, as there's no scandir(). Too lazy to port that for now. You can test it via cygwin though. 2020-03-13 Reini Urban unit-testing: fix leaks add 2010/gh209_1.dwg testcase for GEODATA See GH #209 2020-03-12 Reini Urban unit_testing_all: add -n (coverage) argument to all unit-tests. to silence coverage warnings, and more messages, when being run with an INPUT env arg. so only errors are printed. 2020-03-12 Reini Urban add unit_testing_all.sh.in test all DWGs with all unit-testing/dynapi tests (but not for all objects yet) add PLOTSETTINGS coverage test-data api: layout+plotsettings harmonization same fields, same names. add unit-tests. unit-testing: add unstable HELIX copied from SPLINE configure: add --enable-release to test IS_RELEASE features with a .git subdir no nan doubles in exports, GH #210 IN_RELEASE replace with 0.0 more distcheck: DISTCLEANFILES examples/alldxf* when regen-unknown is triggered 2020-03-12 Reini Urban fix automake distcheck bug GH #211 We could avoid building LibreDWG.info in srcdir, but I don't know how. For now we allow creating the backupdir in $srcdir/doc. We also disable distcheck the bindings, if the builddir has the bindings disabled. 2020-03-12 Reini Urban unit-testing: fixup geodata coverage 2020-03-11 Reini Urban GEODATA: fix typo, extend found the bug via unknown, north_dir is a 2RD. add missing class v1 fields debug GEODATA, with unknown make regen-unknown for GEODATA debug GEODATA. add UNKNOWN fix dwgread fmt outout with corrupt dwg error earlier. Fixes GH #209 fix geojson for GEODATA object we dont know geometry fields yet, so skip it. Thanks to @yossefaz for a testcase with GEODATA. Fixes GH #209 case 1 unit-testing: add unstable geodata without any coverage unit-testing: add unstable light, debugging table unit-testing: add underlaydefinition unit-testing: add unstable visualstyle add test/unit-testing/tablestyl.c an unstable OBJECT change dwg_api for TABLESTYLE to unstable. unit-testing: handle vectors can be NULL esp. with objects unit-testing: CHK_SUBCLASS in hatch unit-testing: TODO unstable objects unit-testing: stricter multileader checks check for valid value ranges (alignment, flags, ...). Found interesting bugs unit-testing: simplify CHK_SUBCLASS_* use the subclass API for all fields. 2020-03-10 Reini Urban add dwg_dynapi_subclass_value, more unit-testing multileader add subclass dynapi checks, as needed in in_json. unit-testing: add gradient HATCH coverage unit-testing: add CHK_ENTITY_CMC add test/unit-testing/multileader.c WIP add test/unit-testing/leader unit-testing: fix CHK_ENTITY_H leak add test/unit-testing/viewport.c add test-data/2004/Underlay.dwg needed for underlay coverage add test/unit-testing/underlay.c fixup test/unit-testing/ preview_size BLL since r2010 already. Detected by asan overflow with new wipeout coverage. add test/unit-testing/wipeout.c fixup encode FIELD_VECTOR_T -Wincompatible-pointer-types we added the T type argument, so a unicode cast is not needed anymore. T texts vs TU 2020-03-09 Reini Urban fix TU32 type for r2007+, either UCS-2 or UCS-4 I suspect this is either a Teigha or AutoCAD bug. But the TU32 feature strings can be either 4 or 2 byte. add TU32 type for FileDepList.features on r2007+ injson: fix eed 1005 size to 8 and error on wrong FileDepList_Files type. testcase: 2007/Leader 2020-03-08 Reini Urban injson: fix xdata_size calculation with BINARY causing encode overflows on overlarge xdata_size injson: also set eed.size correctly realloc and count injson: count eed.size correctly realloc data precisely, but don't yet set the size. injson: fix Unknown HATCH num_polyline_paths field and wrong "polyline_paths[rcount2],point" key injson: protect from NULL dwg_dynapi_subclass_name or empty dwg_dynapi_subclass_fields results. Found via fuzzing, with e.g. a json field like "name.: "..." json: fix json_thumbnail_write skip the sentinel, which is included in the thumbnail.chain, when being read from a R_2004+ SECTION_PREVIEW. There it has an dat->byte = 16 offset, but the dat->byte position is advanced by dwg_bmp() in decode to the real BMP offset. 2020-03-07 Reini Urban injson: ignore R2004_Header.padding This is done by encode (eventually) unit-testing: silence gnu_printf warnings only without __USE_MINGW_ANSI_STDIO use ms_printf, else gnu_printf. 2020-03-06 Reini Urban fix dwg_dynapi_common_value for preview_size UNKNOWN_ENT api: fix dwg_ent_3dface_* api to 3d add dwg_object_to__3DFACE(). add a unit-test for 3dface add test/unit-testing/spline.c more test/unit-testing/hatch unit-testing: fix dwg_dynapi_handle_name leak with unicode texts. declare dwg and version for our macros. add test/unit-testing/hatch.c 2020-03-05 Reini Urban in_json: more DICTIONARY.numitems mismatches crashes at free with fuzzing (again). add more checks dwg: support -Ijson for testing fuzzing results which have no json or dxf extension 2020-03-05 Reini Urban encode: support overlarge objects size > 0x7fff only for wrongly calculated sizes. mostly not in_json. when bit_write_MS (obj->size) needs more than one word, but we wrote only one word for it. 2020-03-05 Reini Urban api: add dwg_dynapi_subclass_field linear search in the subclass. used in in_json, for keys like value.data_type, embedded structs. call _set_struct_field() then recursively. This fixes all the remaining embdedded structs, like TABLE_value, ... We still need the MULTILEADER.ctx.* exception, because this is a union. Note: Just some such . fields have no seperate subclass, like color.index or lt.index. 2020-03-04 Reini Urban fixup {dxf,json}-check overwrite. use correct b dxf: support -y 2020-03-03 Reini Urban fixup echo 2\> svg: improve RAY/XLINE check intersections if out of bounds. avoid div by zero svg: echo the jing validation cmdline svg: add experimental RAY/XLINE svg: honor invisible, comment entity types README: document new optional checkers programs/*test: simplify tests: support LTEXEC with nested builddirs replace hardcoded ../libtool --mode=execute with LTEXEC. Allow empty PROGS and DATADIR in tests svg.test: added to run jing formal SVG validation via make check (to catch regressions) dwg2SGV: list TODOs bsd: declare strcasestr FreeBSD doesn't honor _POSIX_C_SOURCE for strcasestr, only __BSD_VISIBLE. cirrus: freebsd-12-1-snap fails better use the stable, or the upcoming 13-0-snap even more shell scripts in top_srcdir to test with shellcheck, and fix quoting and other issues. add {dxf,json}-check shellchecks with bashisms fix programs shell scripts against shellcheck fix all root shell scripts against shellcheck 2020-03-02 Reini Urban add shellcheck tests but cannot be used together with the rpmlint test. only with the autoconf parallel-tests option, but this does not work with srcdir/TESTS. fix dwg/dxf/... scripts for shared lib LTEXEC requires top_builddir (which is always .) dwgfilter: shellcheck fixes dxf: shellcheck fixes dwg: shellcheck fixes json: shellcheck fixes svg: shellcheck fixes fix configure dash/sh Syntax error: Unterminated quoted string e.g. as on freebsd 2020-03-01 Reini Urban LaTeXML has broken relaxng svg11-basic.rng See https://github.com/brucemiller/LaTeXML/issues/1237 Probe for our, or a fixed LaTeXML one. There is none in any fedora repo. Maybe debian has a working svg schema somewhere. svg: probe for jinq and LaTeXML svg validator for svg.in decode: accept optional empty sections don't fail fataly then. e.g. with Teigha DWG's add check-svg target, via ./svg by adding a validator to the svg, like jing svg11/svg11-basic.rng $out we can catch all svg errors also. svg-validator: fatal: The string "--" is not permitted within comments svg: don't group the *Model_Space entities decode_test: fix leak improve when to realloc the bit chain. avoid excessive realloc from 1 to 40k. 2020-03-01 Reini Urban refactor dwg_rgb_palette, fix odr_violation Define every object only once: ODR (One-Definition-Rule). Use a functional accessor, not a global. Failed only as shared lib on clang with asan. Fixup for 2592a4c8ea081649f0d63a5007834c5660fd92d8 2020-02-29 Reini Urban add dwg_rgb_palette[256], support svg rgb/true colors more colors than just 0-8,256. The palette struct is from my old site xarch.tu-graz.ac.at acadrgb.txt svg: add common_entity with color static color indices 0-8 first only, no rgb or higher palette colors yet 2020-02-29 Reini Urban programs: free on asan only without detect_leaks=0 don't free with asan and detect_leaks=0. In all other cases the leak detector is on. Add some missing --force-free options. 2020-02-29 Reini Urban svg: add --force-free option skip free on large DWGs (performance) svg: add 3DFACE svg: add SOLID (as filled polygon) svg: use viewBox, add ELLIPSE (partially) 2020-02-28 Reini Urban svg: add helper and POINT a POINT is represented as CIRCLE with radius 0.1 (TODO relative to extends) print Ignored ENTITY name to stderr. 2020-02-28 Reini Urban dwg2SVG: add lweight to some entities 2020-02-27 Reini Urban indxf: fix *_CONTROL.entites[] NULL hdl regression #204 We fill the num_entries at the i-th index 2020-02-25 Reini Urban json: enable DECODER_OR_ENCODER e.g. needed for DIMENSION*.def_pt, POLYLINE_2D, ... it just means NOT_DXF {} injson: add RevHistory, ObjFreeSpace sections json: add Security section json: add section AppInfoHistory which is not decodable yet. just binary unknown_bits injson: fix one more DICTIONARY.numitems case fixes .fuzz-out21/crashes/id:000001,sig:06,src:001316,time:68072970+001732,op:MOpt_core_splice,rep:2 2020-02-21 Reini Urban Minor free inconsistencies pointed out by @ManSoSec. Totally harmless. Closes GH #206 injson: protect Illegal CLASS [0] check NULL deref configure.ac: bump Copyright year free: fix 2PT_TRACE artefacts from FIELD_DD in LINE 2020-02-21 Reini Urban encode: init hdl_dat stream earlier #205 add obj_flush_hdlstream to START_HANDLE_STREAM. initially handles are written to a fresh hdl stream. When we reach START_HANDLE_STREAM (entity and object) we flush this to dat. On encode we usually don't know obj->bitsize and obj->hdlpos beforehand. This greatly simplifies the dwg.spec, avoiding 2nd loops just for the handles, and avoiding free problems. 2020-02-19 Reini Urban encode: fix bit_write_DD check the first 2 or 4 byte of the double for eq 2020-02-19 Reini Urban injson: recalc eed.size on wstrings if does_cross_unicode_datversion, i.e. from r2007+ to r2000 we need to shorten the eed size of the size frame. encode does not do that for us, we need to do that in the importers. in_dxf already did that by necessity. The XRECORD.xdata_size and obj->size,bitsize are always calculated. No more INVALIDEED check-json errors in all samples. 2020-02-19 Reini Urban encode: finally fix eed sizes and warn about overflows. we cannot write eed data with size=0, take the previous size from the proper size frame then. 2020-02-18 Reini Urban injson: set XRECORD.xdata_size 2020-02-18 Reini Urban injson: DD bitsizes can vary read/write via json can change double values, which can influence if a DD value is code 2 or 3, which changes the whole element bitsize. DXF also, but there we don't store the bitsize. 2020-02-18 Reini Urban injson: fix eed encoding write data not only when no raw was written anymore. with in_json we dont have raw at all. This writes now all non-starting eed data, and fixes many INVALIDEED encoding errors. fixup TIMEBLL calculation in all modules julian dates: date->ms are seconds (86400 per day) problematic is only DXF which persists reading TIMEBLL as 40 from double. we could speccial-case that, but we don't. simplify LINE ENCODER There is still a bug in LINE.end.x in some cases (bit 2) I think injson: fix ENTITY.linewt roundtrips only convert to mm for DXF, not print nor json 2020-02-18 Reini Urban injson: change DICTIONARY.numitems logic always keep the lower number, but not 0, because this entry might not have existed yet. texts come before itemhandles, so only fixup itemhandles. This still might fail on illegal json with itemhandles before texts, so ignore those texts. Better leak superflouos handles or texts, than a buffer-overflow. 2020-02-18 Reini Urban injson: skip illegal CLASSES same as illegal OBJECTS Change development version formats for rpm, no - fix git-version-gen. rpm versions may not contain a -, just _. => like 0.5.0.1093.1_967f 2020-02-17 Reini Urban injson: more JSON_TOKENS_CHECK_OVERFLOW_ERR this time in the _set_struct_field loops. fixes a fuzzing case, one remaining. injson: fix bit_utf8_to_TV overflow add a final check, when the last \0 cannot be written. Found via fuzzing add rpmlint libredwg.spec check-TESTS This variant works with serial-tests only. When switching to parallel-testing use the commented SPEC_LOG_COMPILER instead. in_dxf: remove exit() on out of mem handle differently injson: fix SummaryInfo.props, add AppInfo 2020-02-17 Reini Urban injson: JSON_TOKENS_CHECK_OVERFLOW found via fuzzing. Almost proper error handling now. But still a few void functions which could overflow the parser tokens. ignore Template.desc, but handle it 2020-02-17 Reini Urban spec: add pslib 2020-02-16 Reini Urban injson: fix Required %s. missing, skipped we set the previous object, but later we still check for [i].* so we need to fixup both loop vars to properly skip it. Found via a new injson fuzzing round 20 2020-02-16 Reini Urban add doc_DIST targets found from rpm spec errors no libredwg.spec.in the git test builders require a .spec beforehand, e.g. copr support --with-perl-install=vendor needed for packaging Integrate and improve libredwg.spec 2020-02-15 Reini Urban add rpm libredwg.spec targetting fedora core 31. just libps-devel is not yet packaged there. jq for 0.11 fix arm cross-compilation which defaults to MB_LEN_MAX 1. include wchar.h in a single place for the needed fixup 2020-02-14 Reini Urban dxf: fixup previous commit, no double cast loss casting a double to intptr_t could loose half of the bits on 32bit, 8 => 4 rather seperate the remaining test value macros. dxf: simplify printing doubles use only dxf_print_rd, no duplicate code cirrus: fails with pkg install git... it has a pre-installed go=git instead. indxf: LAYOUT needs absolute ownerhandle and with DICTIONARY it varies. dxf: enhance static REPEAT limit from 0x7ff to 20000 example_2000 LWPOLYLINE has 3695 points, which failed. dxf: strip ending .00 also in VALUE_RD not just the generic VALUE macro dxf-check: cosmetics convert to test as DXF, to check reading the created DWG. Keeps our DXF in ., creates the audit in test/*.dxf.err Can be check against the Teigha DXF if successful. 2020-02-14 Reini Urban json: add DIMENSION.flag (dxf 70) and _subclass just for commenting and to compare against DXF. "_subclass" with a _ prefix to denote that it's not stored in a field. flag is stored, but computed. Note: _subclass is a duplicate key in an json object, which some json parsers ignore. jq uses the last (as most). 2020-02-14 Reini Urban decode DIMENSION: fixup flag don't clear the set bits, which we set before. Thanks to Lyubomir Savekov dxf: simplify INSERT harmonize dxfb dxf: fix SUB_FIELD_BD which is special-cased for DXF angles (rad2deg). Fixes HATCH angles 50, 51, and LTYPE.dashes.rotation 50 in out_dxf indxf: import HATCH.boundary_handles 330 log: trace TF, not just insane just set a length limit to avoid overlarge binary data (ole2frame, preview) on -v3. emit json LTYPE.strings_area only if has_strings_area. api: refactor LTYPE move style [H*] into dashes, same as in DXF (code 340 in the dashes loop) simplify R_13 loop still need 2 loops for non-handles and hanldes at the end, beware of free. fixup wrong DXF codes for complex_shapecode and shape_flag, mixed up. fixup wrong shape_flag check for has_strings_area rename LTYPE.text_area_is_present to LTYPE.has_strings_area implement LTYPE.style 340 import in in_dxf 2020-02-13 Reini Urban add dwgfilter shell script Closes GH #64 Need a few good examples still. add dwgfilter (WIP #64) custom query and search/replace filters on all objects. probably in a XPath-like expr language. (or maybe just jsonpath dot notation, but XPath has much more features) idea: just pass it through jq https://stedolan.github.io/jq/manual/ via json. dynapi: regen => LAYER.linewt 370 json: added to DXF_OR_PRINT minus one special case: LAYER.linewt untranslated. Now LINE points showing up. json: use bit_utf8_to_TV api: add bit_utf8_to_TV (untested, needs dest buffer) to undo json_cquote 2020-02-12 Reini Urban indxf: better xcalloc check wrong value before calloc() call. fuzzer indxf6 regression. json: fix json_wstring need an ending delimiter, just overwrite the ending " of the string. Ideally we should restore the " after the utf8 conversion, but we don't need the json later. so leave it. json: parse json_FileDepList_Files() as array of objects out_dxf,_json: improve ending .x00 stripper Only msvcrt has this sprintf feature, POSIX not. Do it manually. Now for all numbers, not just a few. json.test: fatalize json roundtrip errors when entities get lost. Fixed with the previous commit encode: fix [MS] obj->size > 0x7fff mixed up the order of RS. This fixes json roundtrips with large objects, e.g. with size 0xd1c9 json: strip ending excessive .0000000000 as in dxf out_json: increase %f precision as in DXF we still have a floating-point roundtrip precision loss in PEXTMIN, causing the HEADER.crc to be different. auxheader: unknown_5rl defaults add FIELD_VECTOR_INL pre-allocated inlined vectors of a type, with const size, like RC name[5] Turn back AuxHeader.aux_intro into an array of 3 auxheader: change RC unknown_20rc[20] to RL unknown_5rl[5] and use TFFx (binary) for JSON, arrays for the rest. TODO: create an inlined vector without malloc: FIELD_VECTOR_INL (nam, type, size, dxf) encode: remove dat->byte -= 6 fixup dont write empty strings ending \0 byte on length 0. roundtrips do match now. add @bitpos to -v5 insane loggings to find out about the wrong TV encoding on empty strings. 2020-02-11 Reini Urban json: fix TIMEBLL repr with the single float value we always the lost two digits. represent it as array of 2 BLs, as in the DWG in_json: protect wrong supertypes with assert, since it's fatal and not fixable. It comes from a wrong mixup of name, dxfname and/or type. Here from a wrong dxfname. encode: fixup header_variables size wrong patchup size logic, needs -6. checked via json-check api: add auxheader to json rename some fields, add RCx type. num_saves would be suppressed by json, rename to numsaves decode: fix the example_2000 3dsolid leak improve the decoding a bit, check bounds. The leak was an improperly read encr_sat_data alive.test: TODO more failing tests dwgrewrite leaks with example_2000 3DSOLID dwgwrite crashes on cygwin dwgrewrite crashes on mingw {dxf,json}-check: support handy td symlink for test/test-data json: change xdata to ARRAY [ type, value ] harmonize xdata tracing TV strings, not TF. convert to TU strings in json if targetting TU (not yet) 2020-02-10 Reini Urban dwg_add_handle: allow actual relative handle codes from json. not just the theoretical code types from the spec. Fixes the json handle inconsistencies, and we could do now 2 handle values only again. but we rather keep it precise. json: add a 2nd HANDLE repr array of 2 [code, absref] or array of 4 [code, size, value, absref] to overcome problem with reverse relative offset calculation in dwg_add_handle free: skip entity color.rgb tracing messages free: skip entity bitsize tracing messages for r13 and r14 encode: fixup wrong comment json: avoid null TU strings TV never prints null, just "" dwggrep: AM_CFLAGS before CFLAGS In case we added -I/usr/local/include to CFLAGS, and had an older libredwg dwg.h installed there, we would pick up the wrong header. 2020-02-10 Reini Urban encode: no bitsize re-calculation with handles Already calculated at HANDLE_STREAM, but them overridden again at the very end, with INJSON only (which does have size and bitsize keys, just unreliable, when down-converting) Avoid that when we have handles. No "bitsize calc from address (no handle)". Fixes acad import/teigha conversion of DICTIONARY et al. 2020-02-09 Reini Urban import: generalize in_postprocess_SEQEND/handles for dxf and json. Create the list of owner children from each SEQEND, esp. when converting r2004+ down to r2000 (with only first/list pairs). Also create common_entity handles when downconverting, taken from in_dxf: prev_/next_entity handles, nolinks flag, xdicobjhandle. 2020-02-09 Reini Urban out_json: fix -Wformat eed.code type encode: undo CRC pos fixup on Wrong object size Fixes import Teigha error for DICTIONARYVAR 1A2 harmonize decode T logging {dxf,json}-check: fix some r calc error: r=test-data which failed on Teigha harmonize encode TV with TU logging See a810101b168da4a954d539c82708da46c0eb3136 2020-02-08 Reini Urban comment formatting only fix -Wsign-compare from mingw fix remaining injson leaks for r14 See GH #197 alive.test: no TODO for dwgwrite all tests must pass, just indxf leaks are allowed. dwgrewrite still fails on mingw64 alive.test: dwgwrite with json does not leak anymore See GH #197 Just example_r14.json and invalid fuzzing json's leak still (TODO) free: fix MLINESTYLE.lines leak again. wrong logic, we need to check against dat->from_version harmonize decode TV with TU logging with quotes and add the type/dxf, for easier json-check roundtrip checks. encode: Imported json sizes are unreliable when changing versions set dat->from_version and dwg->header.from_version differently on in_json. dat->from_version should be R_2000 to keep strings asis, only keep the dwg from_version as proper. 2020-02-08 Reini Urban encode: keep dat.from_version undo the previous minimal DXF import hack. process higher versions on free, because there we need from_version also. (HATCH_gradientfill) 2020-02-08 Reini Urban in_json: fixup invalid DIMASSOC_Ref elems if != 4 don't crash on invalid free of an unallocated ref. Always allocate at least 4, and handle only 4. This new error came up when free of DIMASSOC was enabled. api: simplified new DWG_OPTS_IN infxf or injson 2020-02-08 Reini Urban free: add dwg_free_variable_no_class for leaks with the error-case on a missing class. define all declared classes to be DEBUGGING, because they show up in objects.inc, and can be imported by DXF or JSON, even if we have not defined any order of fields yet. we've just declared them, which is enough. 2020-02-08 Reini Urban in_json: fix version specific HANDLE_VECTOR leaks esp. the 2004 entity lists, which are allocated by an importer, but not encoded nor freed. in_json: fix MLINE.verts/num_lines leak the spec sets MLINE.num_lines from verts[].num_lines, so we need to set in in the importer in_json: fix HEADER.unknown_text1 leak of the IF_ENCODE_FROM_EARLIER_OR_DXF strdup("m") dynapi: add missing VERTEX_3D aliases VERTEX_MESH VERTEX_PFACE. Fixes json roundtrips fatal roundtrip tests on 0 entities only allow some missing entities for now suppress dsymutil echo in some helper tools check-json: fix make -jN jobserver warning See https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html out_json: fix SPLINE_control_point to be compatible with dynapi, and in_json in_json: revise invalid object error handling no DUMMY, ignore and free it. 2020-02-08 Reini Urban in_json: improve invalid object error handling set type to DUMMY, don't skip it. set supertype, parent, index. if inside the object, read all the remaining keys to start at the next. 2020-02-08 Reini Urban in_json: valgrind cosmetics avoid 0 byte leak stats in_json: better fixup numfield logging show ignored value, show assignment. 2020-02-07 Reini Urban stable DYNAMICBLOCKPURGEPREVENTER now fixed examples: update bd-unknown.inc and fix target when in builddir in_json: protect from wrong LTYPE.strings_area length Found via GH #197 fuzzing in_json: stricter object+entity check to avoid mismatches with wrong supertypes, heap-overflows on common_data access and such. Found by fuzzing GH #197 unknown: add more objects/field names update unknown use-after-free, convert to TU, double-free, ... add more ANNOTSCALEOBJECTCONTEXTDATA types unhandled add some AcDbSh DEBUG_CLASSES add more unhandled classes with DXF counterparts from the JW testcase. GH #200 add 3 new unhandled ACME classes AutoCAD Mechanical. from the JW testcase, GH #200 unknown: regen and fixup for builddir 2020-02-07 Reini Urban json: fix filedeplist and FIELD path keys key only, without obj[rcount1]. use FIELD_VECTOR for filedeplist (much easier than a REPEAT block). Thanks to Vimal Pillai for his testcase in GH #200 Now the features array is always present, an empty files array not. 2020-02-06 Reini Urban in_json: add BL* support for LWPOLYLINE.vertexids r2010+. Thanks to Vimal Pillai for his testcase in GH #200 check programs: display roundtrip fail (TODO) fixed unit-testing/ole2frame now with proper TF support more TF -Wpointer-sign fixes from clang 2020-02-05 Reini Urban wrong loop, detected by latest clang -Wfor-loop-analysis TF unsigned char*: fix out_json %02X for char > 127 set BITCODE_TF as unsigned, avoiding printing FIELD_BINARY/FIELD_TF as FFFFFFxx (negative sign extended to -int) Fixes GH #199 dynapi: ent->preview TF not just char* but the fields already had it. harmonize FIELD_TF loggins %02X not %02x, to be easier comparable to FIELD_BINARY output with JSON and DXF 2020-02-05 Reini Urban add dynapi_test_all.sh for all test-data DWGs. Higher coverage, lot's of nan's Improve *clean rules a bit. 2020-02-03 Reini Urban check: add json and dxf roundtrip checks still TODO. count the number of created entities, how many are lost in_json: fix more string leaks they are allocated fresh in the dynapi in_json: fix eed string leaks they are copied into data. See GH #198 2020-02-03 Reini Urban dwgwrite: free on critical importer errors to avoid leaks. Also tune the in_json object_map hash. 2020-02-03 Reini Urban make json-check -v3 easier comparable absolute offsets only with LOG_HANDLE -v4 in_json: type the missing names api: rename XRECORD.num_databytes to xdata_size it is a size after all, not a num_ in_json: add missing XRECORD.xdata Closes GH #198 out_json: add missing XRECORD.xdata See GH #198 in_json: fix Unknown CLASS key proper error handling, fixing a fuzzing heap-overflow GH #197 in_json: Improve fatal error on required keys check on next object also. Fixed all but one GH #197 fuzzing crashes. in_json: Fatal error on missing OBJECTS type though theoretically we could search for the type, as we do for our internal fixedtype. Fixes GH #178 fuzzing crashes in_json: fatal error if OBJECTS handle is missing Fixes GH #178 fuzzing crashes 2020-02-03 Reini Urban in_json: ignore OBJECTS index field we really need to use our own for an reliable objid. It is treated just as a comment. Also fixup TableCellContent_Attr.index subclass field. Fixes GH #178 fuzzing crashes 2020-02-03 Reini Urban in_json: log empty arrays, key: [ ] in_json: read eed[] See GH #198, fixes the EED part. out_json: add eed array of objects some with size and handle, the others only code and value. See GH #198 in_json: wrong DICTIONARY.numitems fixup 2020-02-02 Reini Urban in_json: fix heap-overflow on parser errmsg fix another head overflow to the right side this time. Found by the 2nd fuzzing round GH #179 encode: fix null deref with empty klass->dxfname Fixed now all fuzzing crashes GH #197 (for now) in_json: ignore DICTIONARY.numitems also we still have a wrong Inconsistent warning though in_json: set target version to R_2000 to avoid unnecessary widestring back and forth conversions, because we can only write R_2000 for now. Later turn it back on. in_json: add wstring and FileDepList in_json: clang-format in_json: error on duplicate OBJECTS or CLASSES arrays in_json: !obj->dxfname error case when it is not a string, set a default. Fixes a double-free, GH #197 in_json: add json_binary helper out_json: workaround FileDepList NOCOMMA hack on empty content. we dont emit the num_ fields anymore, and here no empty arrays neither. 2020-02-01 Reini Urban in_json: set all num_ and _size fields from the ARRAY and skip it's explicit keys. out_json: skip all num_ fields to avoid in_json array mismatches {json,dxf}-check: fixup r for teigha in_json: fix object/entity name stack overflows See GH #197 in_json: support Template section which is actually used by r2000 encode in_json: support SummaryInfo section with some parsing problems in_json: support R2004_Header section even if it's yet unused for R2000 encode fixup in_json: protect from NULL json_HANDLE Don't get the hdl[] twice. And log the H* index See GH #197 in_json: handle all 310 strings as FIELD_BINARY i.e. TF See GH #197 2020-02-01 Reini Urban api: harmonize _size suffix for FIELD_BINARY all FIELD_TF/FIELD_BINARY (310) fields, get an associated name_size field (not _length, ...). And don't emit it on out_json, rather emit the binary string only. 2020-02-01 Reini Urban in_json: initialize dwg->object_map Needed for dwg_add_handle() See GH #197 in_json: add json_update_sizefield fixup a wrong preview_size field, (and later maybe more) TODO: remove those redundant sizefields, and rather encode the binary string properly "\000\000...." See GH #197 in_json: Improve fixup of Invalid type fixedtype is calc. from the name (which is our stromgest assertion). Fixup any wrong type < 500, or fixedtype <= OLE2FRAME (above can be a class) See GH #197 2020-02-01 Reini Urban in_json: fixup DICTIONARY.numitems which is used for 2 arrays keep the smaller numfield of the two arrays itemhandles[] and texts[]. Also for DICTIONARYWDFLT. Also add missing H* and TV* logging. See GH #197 2020-01-31 Reini Urban in_json: check Invalid type when the name and the type do not match. Fixes fuzzer crashes in_json: protect from NULL json_HANDLE forgot one NULL klass->dxfname check detected by in_json fuzzing. in_json: change num_tokens to signed to detect parse errors. in_json: fix stack-overflow on parser error dwgwrite: disable llvm_mode persistent mode The loop crashes. Don't know why yet, works fine with dwgrewrite. dwgread: support reading from stdin when no optional infile argument was given. print a notice to stderr on -v1. Analog to dwgwrite to support pipes dwgwrite: support -y -o /dev/null for fuzzing much faster fuzzing 2020-01-30 Reini Urban fix last clang -Wtautological-constant-out-of-range-compare Do a compile-time range check. Note: The taylor-series approximation for log2 does not help here. we only have 7 values to check against, and we want to avoid -lm. __clz would be better, but our current check is better. 2020-01-30 Reini Urban in_json: wrong version comparison, always false out_json: remove IS_PRINT for DXF_OR_PRINT: don't do the DXF conversions, just do the mundane simplier FIELD_* instead. E.g. linewt not converted (0x1d/29, not -3) in_json: no relative handles for reactors observe the original code, if >=6 for relative or not. change check-dxf and add check-json targets check roundtrips for all our test DWG's, if the re-created DWG is valid (via Teigha). See GH #195 json-check: new checker analog to dxf-check check proper roundtrips, if the dwg generated from a json can be read by Teigha dxf: improve dxf analog to dwg and fix a typo dwgwrite: add --force-free for leakage testing dwg: add JSON support, not just DXF and rather use dwgwrite, not dxf2dwg in_json: check and update numfield for all objects arrays. Fixes GH #169 2020-01-29 Reini Urban dwgwrite: add afl-clang-fast support api: change num_unknown_bits from ulong to RL was problematic on 32bit, uint32_t is enough cirrus: autogen.sh requires now git in_dxf: warn -> trace Misleading num_entries see comment and GH #195. It is not a problem. 2020-01-29 Reini Urban in_json leaks: add DWG_OPTS_INJSON where even obj->name is dynamic, and needs to be freed. Free the temp. obj->unknown_bits. leaks in_dxf: 533 (mostly strings) in_json: 1884 (strings) 2020-01-28 Reini Urban in_json: fix the biggest leaks and fix wrong tokens->tokens++, it is tokens->index++! Otherwise we cannot free it. 66k remaining, mostly the unknown_bits strings. doc: Update manual in_json: fix HANDLE double-frees analog to in_dxf dwgwrite: support JSON now officially. many large leaks remaining (1MB per example_2004) doc: FreeCAD uses now LibreDWG See GH #195 in_json: fixup subclass elem[] index it is a char* pointer only dynapi: fixup T types esp. needed for TF and TFF types. TF, TV, TU, T or even TFF. BINARY is TF. in_json: special-case LTYPE.strings_area TF (256/512) otherwise we get a heap-overflow in encode json,encode: add num_unknown_bits to avoid overflows on encode. actually encode the bits. 2020-01-27 Reini Urban json: rename unknown to unknown_bits and encode it. The size may overflow on writing. TODO eed, common_size to calculate num_unknown_bits. Or emit it -Wmaybe-uninitialized with older compilers in_json: parse unhandled sections in_json: harmonize error messages and delete dead code. in_json: support the 3 known static arrays and add a symetric dwg_dynapi_field_get_value (no text yet needed) in_json: fixup MULTILEADER.ctx.content with new dynapi union keys. Closes #194 dynapi: support unions and inlined structs MULTILEADER.ctx not yet, but MLEADER_Content.txt.default_text. The idea is to support both, inlined and extra. See #194 json: fix MLEADERSTYLE.block_scale to 3DPOINT so that it can be easily read via the dynapi fixup dynapi.c #line for debugging only in_json: delete dead exporter code We will need FIELD_TV and more strings later, for the other sections. Maybe even VECTOR and REPEAT. in_json: set obj->fixedtype via linear search in objects.inc, not in CLASSES. CLASSES only have the real dynamic type, not our fixed enum. in_json: add unknown bits (binary) json: add unknown bits (binary) fix bits_test make it fail, adjust offsets 2020-01-27 Reini Urban dynapi: fix dwg_dynapi_fields_size add size for each struct. add helpers _find_entity and _find_subclass, add exported dwg_dynapi_entity_size() and dwg_dynapi_subclass_size() fix dynapi_test for test_sizes (just cygwin got it right) TODO one missing PROXY_LWPOLYLINE size/fields entry in dynapi. 2020-01-27 Reini Urban in_json: start handling inlined MULTILEADER structs and unions. TODO: add the keys with . to the dynapi, like ctx.has_content_txt and ctx.content.txt.default_text See GH #194 json: disable HANDLES section it is not really the HANDLES section omap, which would be relative in both. And it is not needed to encode, it is created only from the objects[] there 2020-01-26 Reini Urban dynapi: test sizes if the sum of all fields equals the builtin sizeof(struct) dynapi: fix dwg_dynapi_fields_size for something like VERTEX_PFACE (VERTEX_3D alias) dynapi: fix DIMASSOC_ref => DIMASSOC_Ref find the subclass json: fix _names, like _3DFACE strip the _ prefix then. These names are not exported, the dynapi accepts only names without json: fix duplicate object key with classes on dwg_json_variable_type success don't jump to invalid_type:, adding all object keys again. in_json: fix json_advance_unknown for objects and arrays. Improve duplicate objetc/entity check, e.g. DICTIONARYDFLT with mult. object, index, ... Handles this out_json bug correctly. dynapi: add union support add recursive out_declarator(), for MLINESTYLE_liine.lt.{index,ltype} Closes #194 in_json: enable _obj->size skip obj->size if already done. and other similar fields. Fixes WIPEOUT.size in_json: improve FILEHEADER add HANDLES, but ignored. encode creates a new omap on the fly. TODO lt.index is not in dynapi, and a wrong field name json: improve color fields CMC can be index alone with color also, to fix unknown color.flag in out_json. either index alone or object. in_json: support BINARY strings (dxf 310) and add more, faster json type checks out_json: fixup fields for nested struct paths only print the field name, not the full path with "[rcount1]." included. Needed for in_json 2020-01-26 Reini Urban api: change Dwg_SPLINE_point* to BITCODE_3DPOINT* Use an ordinary 3DPOINT vector fit_pts, without parent. We use that type for LEADER.points also. The problem appeared in in_json 2020-01-26 Reini Urban in_json: fix array of subclasses Add entity types: BT, 2RD*, BD* 2020-01-26 Reini Urban dynapi: add dwg_dynapi_field_set_value() set field value in arbitray struct, if entity, object, common or subclass. Needed for in_json, the very generic way. api: const some handle api args. in_json: add _set_struct_field() using dwg_dynapi_field_set_value() recursively (for subclasses). use it for all kind of structs. add missing obj->parent dwg's 2020-01-26 Reini Urban dynapi: add internal dwg_dynapi_subclass_name to get the subclass name from the f->type. To get the size of the struct in_json: more OBJECTS: arrays H*,TV*,... fixup cfields (common overwriting specific fields) api: protect from empty obj->parent or objid with in_json even the first BLOCK_HEADER objid = 0 will be used with the dynapi to set the ownerhandle, ... Allow objid 0 there. in_json: add OBJECTS, and dwg_dynapi_fields_size() to avoid the objects.inc linear search. We just need to dynamic size to allocate the object-specific _obj, no static typing needed. Much simpler than in the DXF importer. in_json: parse POINTS, CLASSES in_json: parse TIMEBLL, CMC, HANDLE types in_json: start working on it parents not needed. only different from i-1 for primitives (keys, array members). 2020-01-26 Reini Urban Update jsmn: modernized no jsmn.c anymore, just a single header. tune the importer for the new jsmn header, esp. use JSMN_STATIC. we only need it once, in in_json.c 2020-01-26 Reini Urban add in_json with MIT jsmn WIP as a submodule 2020-01-18 Reini Urban preR13: fix logical PREP_TABLE error always returned an error, missing braces (Ouch) 2020-01-18 Reini Urban fix leak in 2nd HANDLE loops e.g. MLINESTYLE.lines or LEADER.arrowheads. On FREE don't free the array after the first loop, otherwise we cannot free the handles from the 2nd handlestream loop later. Closes GH #191. Only preR13 leaks in fuzzed DWG's remaining, all other fuzzed test DWG's (>1000) don't leak on decode anymore. 2020-01-18 Reini Urban fix XRECORD.objid_handles leak on num_objid_handles == 0. See GH #161 free: fix minimal encoded HEADER.HANDSEED leak See GH #191 2020-01-17 Reini Urban free all NULL handles just not with INDXF. Fixes more handleref leaks, see GH #191 free: fix DICTIONARYWDFLT.texts[] leak on overflow errors. don't reset numitems to 0 in the 2nd VECTOR using the same numitems. We still need to free the first VECTOR_T. This was already fixed for DICTIONARY.texts[] See GH #191 free: fix entity 2007+ color.handle leak See GH #191 free: fix entity color.*name leaks fixup flags, so that the mask matches. See GH #191 decode: fix 2007 class section leak on error Invalid max class number. See GH #191 MLINE: fix leaks with invalid num_* fields FIELD_VECTOR overflows apparently dont free all fields See GH #191 free: fix MLINESTYLE color leaks esp. wrongly allocated names. See GH #191 spec: change RC NUM_* to RCu no hex logging for num_ fields free: fix UNKNOWN_OBJ leak on ERROR: Wrong TABLECONTENT.type for obj != TABLE. Some dxfname mixup should not be fatal for free. Check the types. See GH #191 decode: fix 2007 system page leaks on ERROR: Invalid section->pages[0].*size and similar early aborts. See GH #191 remove .gitlab-ci.yml it is not free, you have to find a runner by yourself. (or use some limited Google Cloud runner) The gnu gitlab instance recently started to annoy with CI errors, because there was no runner configured decode: fix 2007 data_page leak on errors On the OUTOFMEM decode_rs() error. See GH #191 decode: fix EED leaks on ERROR No EED[%d].handle See GH #191 decode: fix class leak with Invalid max class number See GH #191 2020-01-17 Reini Urban decode: skip EED parsing on illegal bitsize Also fail early on invalid owner handles (not 0.x.x). TODO: We might try to reconstruct the handle (previous plus one, with known handleoffset) and search for it, to re-align the lost position. It's next to impossible that with an illegal size/bitsize, EED can be parsed correctly, which is then subsequently leaked. Try at least the other Common EED Handles then. Fixes fuzzed dwgrewrite leaks of EED. See GH #191 2020-01-17 Reini Urban fix FUNDING.yml format for patreon Create github FUNDING.yml logs-all.sh: larger timeout for test-big 2020-01-16 Reini Urban README: list more supported optional tools decode: section info types and formats decode: protect overlarge section sizes > 2GB. Fixes crashes7, id 1 Also protect the right side of dat->chain and decomp. Fixes the remaining GH #188 case, id 168. indxf: more NULL ptr protections and illegal MLINE asserts. Closes GH #189 and GH #190 dynapi: allow setting NULL ptr to a string. Fixes case null_pointer29 of GH #189 indxf: protect from uninitialized object undo NEW_OBJECT when unknown. Fixes null_pointer25 of GH #189 indxf: protect from invalid DXF 0 null (EOF and ENDSEC checks) Fixes 16 GH #189 cases indxf: fix 3x NULL pair SEGV Fixes GH #186, and 2 cases of GH #189 decode: re-add one more sections check Fixing id 31 of GH #188. check for NULL sections (Template), and info->size overflow decode: fix section size check for TEMPLATE 0 bug with Teigha. Fixes e.g. 2004/dbcolor.dwg 2020-01-16 Reini Urban decode: fix uncompressed section overflow for the last block, the size may be smaller. only read this then. Fixes all but 2 id's of GH #188: id's: 6,15,31,91 2020-01-16 Reini Urban decode: check section sizes skip section on outofbounds sizes: max_decomp_size (block size) > 0x8000 or impossible overall size. Also, with mult. blocks the size must exceed the size of the first block. in case of errors calc the true sec_dat->size to avoid heap overflows. Fixes id's 0,4,8,9,16,34,36,46,171,203 of GH #188 2020-01-16 Reini Urban dwgbmp: protect against BMP size overflow do the same dwgbmp checks as in decode. "Invalid thumbnail data" on overflow. Fixes Case 2, id 203 of GH #188 2020-01-15 Reini Urban strings: add FIELD_T conversion tests, NEWS Closes GH #185 indxf: ditto from_version and TU conversions 2020-01-15 Reini Urban encode: add bit_write_T, clarify from_version <=> version do the necessary up and down conversions TF <=> TU. reading always stores in the from_version format, writing always writes in the version format. but reading does not seperate the both yet, only when writing dat->version/dwg->header.version is set. This e.g. fixes reading EED wstrings from -EED[0] code: 0 [RC], wstring: len=24 [RS] "䄀挀䐀戀匀愀瘀攀搀䈀礀伀戀樀攀挀琀嘀攀爀猀椀漀渀" [TU] +EED[0] code: 0 [RC], wstring: len=24 [RS] "AcDbSavedByObjectVersion" [TU] and all the dwgrewrite to r2000 strings. 2020-01-14 Reini Urban silence wrong -Wuninitialized with older compilers. fix test/unit-testing/hash_test leak indxf: more NULL pair protections Fixes GH #186 json: fix NULL deref of obj->dxfname json_cquote: fix Invalid characters in \uXXXX escape add a hex helper and fix a off-by-one bug, resulting in \u000: add json helper analog to dxf,dwg,log 2020-01-13 Reini Urban add make regen-dynapi target and remove the automatic dynapi generation, which was problematic with git and dwg.h updates. See GH #184 json: fix cquoting for text vectors and convert \U+xxxx to \uxxxx notation. E.g. with ASCII strings (size, the actual size. not max_decomp_size api: rename AppInfo.unknown_rl to num_strings and add a few example values fixup mandatory Template section Teigha 4.3.2 saved 2018/PolyLine3D.dwg does not have this section, so relax the error level. Just report it. fixup read_2004_compressed_section overflow check For 2018/PolyLine3D.dwg from Teigha 4.3.2 2020-01-13 Reini Urban api: add dwg_obj_layer_set_name And add type checks. For all other objects this kind of API is deprecated, hmm. We should really use the dynapi for this. Closes GH #74 2020-01-13 Reini Urban document section changes in NEWS read_2004_compressed_section: adjust for empty sections Add a seperate writer index j for the info->size chunks being written. Fix the uncompressed write overflow check. Fixes GH #183 (fuzzed) 2020-01-12 Reini Urban add template and objfreespace sections template is the 2000 MEASUREMENT section (maybe rename the old one), free the new sections no new decode leaks decode: fix read_2004_compressed_section overflow with uncompressed pages, for the rest of the last page. don't overwrite the next malloc via memcpy. e.g. DS_Libereco_R2004.dwg for AcDb::AppInfo[1] decode: improve 2004 section type search add fixedtype, the static enum DWG_SECTION_TYPE as resolved by name to search for. Not the type id as read from. Helps in searching dynamic types, such as FILEDEPLIST or APPINFO which types do vary decode: set all section->type for all 2004-style sections api: rename dwg_section_type to dwg_section_wtype have seperate functions for char* and wchar*, later needed for 2004 decode to search for dynamic types from name as with 2007. to get rid of our section_*_type hack. decode: add unknown RevHistory, AppInfoHistory sections decode: add unknown VBAProject section 2020-01-12 Reini Urban decode AppInfo, FileDepList, Security sections, T16, T32 types Add T16/TU16, T32 string types (different length encoding) TODO encode, free. Maybe use an array for the variable types. The Security section is yet untested. dwg.h: re-sort Dwg_Data, most used first 2020-01-10 Reini Urban Release 0.10.1 de/encode: protect more class overflows and NULL reset num_classes with r2007. check NULL dwg. check NULL dwg->classes. found via fuzzing remove outdated dejagnu deps we dont depend on it anymore for some time already cirrus: add p5-Convert-Binary-C switch cirrus to freebsd-12-1-snap See https://cirrus-ci.org/guide/FreeBSD/ They are using Google Cloud Compute images: 13-0-snap, 12-1-snap (stable), 12-1 (release) 12-0, 11-3-snap and 11-3. Not our old image anymore, hence the python problems switch cirrus to py37 py36-libxml2 does not exist anymore dwg2SVG: protect from wrong style id's 144 and 109 of GH #182 Closes GH #182 htmslescape: fix off-by-one and overflow ditto. Fixes GH #182 htmlescape: fix off-by-one and overflow need \0 termination to do strcat. don't skip the very first char. Fixes GH #182 dwg2SVG: skip nan values dwg2SVG: skip NULL text_value Fixes Case 1 of GH #182 2020-01-09 Reini Urban add reedsolomon.h we will use it soon reedsolomon: missing config.h needed for HAVE_MALLOC_H consistent logging handlers, no fprintf, stderr in the lib library users want to catch fprintf and/or stderr. Closes GH #181 indxf: silence clang -Wdouble-promotion use (double)NAN, as it's apparently only float there, __builtin_nanf(). decode eed: accept raw with unknown codes For dwgrewrite passes it through, and let data be empty. And fixes a EED raw leak with such unknown codes. 2020-01-08 Reini Urban dwgrewrite: fix leaks on early errors 2020-01-08 Reini Urban Release 0.10 Major bugfixes: * Improved building the perl5 binding, proper dependencies. Set proper -I and -L paths, create LibreDWG.c not swig_perl.c * Harmonized INDXFB with INDXF, removed extra src/in_dxfb.c (#134). Slimmed the .so size by 260Kb. Still untested though. * Fixed encoding of added r2000 AUXHEADER address (broken since 0.9) * Fixed EED encoding from dwgrewrite (a dxf2dwg regression from 0.9) (#180) See NEWS and ChangeLog decode: protect xdata overflows reset the lengths when stopped reading invalig xdata, which would overflow later. api: rename BLOCK_HEADER.preview_data to preview analog to the entities. In the headers called PreviewIcon. encode: fix LOG_TF crash on null field encode: fix EED writing which was broken with indxf. don't write raw plus data (from the next indices), when a previous raw already covered it. Fixes GH #180 2020-01-07 Reini Urban encode: enable TF logging -v3 or -v5 decode: disable -v5 object_map printing printing the whole object for the handle (again) makes no sense. maybe later print the object name of the handle encode: eed entity formatting logging fix endless loop in 2004 decompression on dat overflow. This fixes all remaining fuzzed dwgrewrite hangs indxf: fix endless MULTILEADER loop with unknown DXF groups. This fixes all fuzzed indxf hangs. decode: fix a -Wsign-compare and some -Wformat protect strncpy from truncation without ending \0 fix TIMEOUT_30 duplicate remove the automake hack decode: fix bytes_left calc. in decompress_R2004_section and add various counterchecks. missed the final lit_length 2020-01-07 Reini Urban hangs: protect from overlarge mallocs when using user-provided section sizes. max_decomp_size, decomp_data_size, ... max ~790Mb per compressed section Fixes a few fuzzer hangs. 2020-01-07 Reini Urban indxf: add only full classes with all names and mandatory DXF fields 2020-01-06 Reini Urban dwg: enhance the dxf2dwg timeout to 30 larger DXF need longer indxf: skip setting buffers twice, with the exception of 310 previews, as in PROXY_ENTITY and Surfaces. indxf: avoid hang when reading illegal numbers advance the ptr before erroring out indxf: fix CLASSES hang 2 CLASSES must be followed by 0 CLASS, else it might realloc constantly, leading to DOS/hang. faster aligned bit_read_fixed, bit_write_TF when aligned use memcpy, esp. for large data blocks indxf: fix double entity.preview write which would corrupt the previous preview, not matching the preview_size. we dont append, we rather ERROR protect bit_utf8_to_TU from invalid UTF-8 count len, not to overflow the utf8 string. e.g. "4è^C" indxf: stabilize adding BLOCK_CONTROL.entries fuzzed DXF could lead to heap overflows (wrong i) indxf: protect SUMMARY header fields by checking NULL and the code 1 2020-01-06 Reini Urban indxf: fix invalid free of static obj->dxfname when dxfname came from dwg_encode_get_class() -> dxf_encode_alias() returning a static string. This should fix all the remaining fuzzing crashes. (for now) 2020-01-06 Reini Urban decode_r2007: protect from section overflow when reading invalid section pages decode: protect from empty dat sections r2007+ e.g. wrong summaryinfo, objects or handles. some of these dont return a critical error protect xdata overflows in encode and decode. proper error handling, esp. with fuzzed wrong data. Update docs for 2020 encode: add LOG_INSANE_TF EED logging still broken. GH #180 Bump Copyright years to 2020 of all changed files so far, with more than a few lines encode: add LOG_TF from decode fixes xdata[] binary logging 2020-01-06 Reini Urban Add AFL_COMPILER persistent llvm_mode support to dwgrewrite Instrument overly long functions as such. Support persistent llvm_mode, via afl-clang-fast for dwgrewrite. export AFL_PATH=/usr/local/lib/afl PERL=cperl5.30.0-nt \ CC="afl-clang-fast" \ CFLAGS="-O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer" \ ../configure --disable-shared --disable-dxf --disable-bindings export ASAN_OPTIONS="abort_on_error=1:detect_leaks=0:symbolize=0:allocator_may_return_null=1" AFL_USE_ASAN=1 make -j4 -s -C src AFL_USE_ASAN=1 make -j4 -s -C programs dwgrewrite AFL_SKIP_CPUFREQ=1 afl-fuzz $@ -m none -i ../.fuzz-in -o .fuzz-out programs/dwgrewrite -v0 @@ /dev/null 2020-01-06 Reini Urban decode: eed logging searching EED leaks with fuzzed DWGs. let the last invalid EED[idx] leak in this case init bit_read_TF when bit_read_fixed failed earlier with overflows, set the bits to 0. valgrind with fuzzing 2020-01-06 Reini Urban api: add int *isnew param to all dynapi _utf8text functions we really need to know exactly if the returned string is freshly malloced (from a r2007+ wide string), or the original string, which may NOT be freed. Fixes the remaining fuzzing double-free's, where the dwg/obj version or string TF type might disagree. Tried hard to avoid this. 2020-01-06 Reini Urban dwg_find_dictionary: add NULL ptr protections indxf: add xcalloc, exit on Out of Memory indxf: protect invalid double DOS advance endptr, with nums like 28ABC.... indxf: protect invalid DIMASSOC_Ref index indxf: protect DIMSTYLE_CONTROL.morehandles[j] gracefully fixup check bytes_left for decompress_R2004_section 32bit the overflow check does not work with 32bit, only 64. Fixes up 80d17da65507ca1242c48ffe3b31afa48a0859aa 2020-01-05 Reini Urban Update NEWS dxf_read_file: properly end DXF with a final \n and \0 for libc strtol/strtod readers, to avoid internal errors on truncated files we cannot avoid. indxf: more truncated DXF protections but not exhaustive. We really need to add a final \n to the read chain indxf: stricter MLEADER subclasses On unknown DXF code break the loop, and continue with the main MLEADER loop. Add a few more array index asserts. Fixes a few fuzzing cases. indxf: protect from MLEADER blk/txt mixup a union 2020-01-04 Reini Urban indxf: fix truncated dxf gracefully end on EOF or invalid ctrl object. prevent indxf buf and most dat overflows. indxf: fix double-free of BLOCK_HEADER.*Model_Space when reusing it. Check if not already done before fix dwgrewrite for preR13 with VPORT_ENTITY table yet unsupported, dont add its num_objects to the table. auxheader: protect from NULL HEADER.HANDSEED usually with encode encode: protect from NULL obj->parent when erroring out early decode_r2007: add decode_rs src overflow check add the size of the src, to overvoid reading past it. and use the actual computed src_size args, not the user-provided ones. improve r2007 copy_compressed_bytes check check for overflows before the loop. better than c893d847716aa6d64c2ff25834c80b43c4806f9b check bytes_left for decompress_R2004_section Fixes heap overflows with fuzzed section values fix bit_read_fixed overflow fix bit_search_sentinel overflow with empty dat chain indxf: add_SPLINE cosmetics indxf: set WIPEOUT.clip_verts[] num_clip_verts got reset every pair indxf: dxf sources are always utf8 for dynapi. without is_utf we assume the source is already TU. no changes name Fixes a few fuzzing cases encode: fix 2NDHEADER address needs to be recomputed, even with dwgrewrite. Fixes section[3] address or size overflow with r2000 DWGs encode: detect section address or size overflow already in encode, not just later in decode. i.e. only with r2000 DWGs encode: always set 2ndheader section addresses even with dwgrewrite. dwgrewrite: fix filename_out leaks use a var when suffix is used. dxf2dwg, dwg2dxf: allow /dev/null sinks dwg_write_file: allow /dev/null sink 2020-01-03 Reini Urban indxf: fix TABLESTYLE rowstyles init indxf: more NULL pair protections dwg2svg2: protect from empty BLOCK_HEADERs name is not really needed add r2007 Page out of bounds check Fixes case 1 of GH #179 fix bit_search_sentinel out of range check off by 16, the sentinel length. Fixes case 2 of GH #179 fix read_R2004_section_info out of range check forgot 32. Fixes case 3 of GH #179 protect r2007 section.num_pages overflow skip section when >0xf0000. Fixes case 4 if GH #179 protect r2007 decode compression length length is a user value, add src_end. Fixes GH #179, case 5 Fix NULL ptr deref in get_next_owned_entity Fixes case 6 in GH #179 dwg2svg2: fail on NULL _hdr Fixes GH #179, id:000026 (case 7) dwg: add missing dynapi.h code added with 0.9, commit 359502ac86b389b248a9080c9ba8462aff1058ee relevant only for --disable-dxf indxf: more NULL pair protections 2020-01-03 Reini Urban api: move 2 DIMENSION handles to DIMENSION_COMMON with in_dxf when changing the type this would change the offset of DIMENSION.block and DIMENSION.dimstyle, leading to invalid pointers. found via fuzzing, fixes 3 cases. TODO: block has still DXF code 0, maybe indxf read DXF 2 into that. Need a testcase for that. 2020-01-03 Reini Urban encode: add OVERFLOW_NULL_CHECK_LV to check the ptr before loops 2020-01-03 Reini Urban indxf: skip creating empty invalid objects rather dont create them than leaving them without type or name. not unknown, but DWG_TYPE_UNUSED. We dont want to check all object[i] loops. Reverts the previous commit for a fuzzing testcase. 2020-01-03 Reini Urban dwg_find_table_control: protect from NULL object.name which might happen somehow via fuzzing. indxf: LEADER.points array protections with asserts indxf: replace IMAGE.clip_verts asserts with graceful logic. Actually failed in the good tests, not just with fuzzing indxf: IMAGE.clip_verts array protections with asserts indxf: add_HATCH array protections with asserts indxf: add_SPLINE array protections but here do it gracefully, no asserts indxf: more eed point protections indxf: add new_LWPOLYLINE asserts on illegal array accesses. Here we rather abort. indxf: NULL pair protections in new_LWPOLYLINE fixes a few fuzzing cases fix bit_write_CRC* overflows analog to read, fixes some fuzzing cases dwg2dxf: fix leaks on section overflow error 2020-01-02 Reini Urban indxf: protect eed points with wrong codes found via fuzzing indxf: some more ptr protections fix strange dwg_class_is_entity miscompilation where it returned wrong results. (comparing a short field with an const int, without zeroing the previous short) Add various measures. indxf: fix postprocess_SEQEND use-after-free the owner handles are used, they are not copied. 2020-01-02 Reini Urban fix write-as leaks In free check from_version in the spec, not the version we were last using (writing to). Fixes most dwgrewrite leaks, just one eed leak remaining, from the 2nd r2000 read. 2020-01-02 Reini Urban bits: avoid uninitialized reads on bit realloc in bit_calc_CRC encode: Fix -Wpointer-bool-conversion address of data->u.eed_0.string is always true encode: fix Too many sections when down-converting from r2004+ to r2000, with typically 10-30 num_sections. enable dwgrewrite with --disable-dxf for fuzzing api: Add LIBREDWG_VERSION et al to include/dwg.h api: renamed CLASS.wasazombie to is_zombie i.e. was_proxy, or class not loaded indxf: is_entity logging for CLASS 281 adjust dynapi_test for LAYER_INDEX layer_entries was renamed with e3374397f386fd1b38b8d732a6ef601ddf7ec592 (0.9) and then later again. adjust dynapi_test for SORTENTSTABLE sort_handles was renamed with e3374397f386fd1b38b8d732a6ef601ddf7ec592 (0.9) dynapi: add nan checks TODO add DEBUGGING_CLASS_CPP and use it for TABLECONTENT. This is more stable than CLASS_DXF in cases when TABLE is mixed up with TABLECONTENT. See e.g. GH #178, where it fixes the heap_overflow2 case. prepare 0.10 NEWS 2020-01-01 Reini Urban decode ERROR cosmetics api: remove DWG_SUPERTYPE_UNKNOWN fully we now have only entity or object, unknown_bits are parts of these. xmlsuite: proper add_helix indxf: fix num_entries/i underflow for the i = -1 case. (Fuzzing) free: fix invalid dwg_free_LAYOUT dynapi: remove UNKNOWN tests as the obj->name does not fit the fixedtype anymore for partially handled classes, like TABLE or ARC_DIMENSION 2019-12-31 Reini Urban cleanup tio.unknown not needed anymore, we only have UNKNOWN_OBJ or UNKNOWN_ENT with full common entity_data. Fixes GH #178 heap_overflow2 encode: object.size overflow decode fails when it overflows, but encode does not know its final dat->size, so introduce a sensible limit. Fixes the dos testcase of GH #178 decode: protect from preR13 section size overflow More fuzzing testcase in GH #176 with some broken sections decode: protect from section size/address overflow There is one fuzzing testcase in GH #176 with some broken sections dwg_free_object: avoid uninitialized is_entity warning even if logically impossible. encode: protect dwg_encode_eed_data overflows encode: protect NULL eed string indxf: more NULL ptr protections fixes more fuzzer testcases free: protect freeing obj->dxfname dont set INDXF when HANDSEED is missing. e.g. GH #178 null_pointer2 testcase indxf: fix rootcause for prev. commit Fail on duplicate CLASS groups, i.e. when O CLASS is replaced by 2 CLASS. free: fail on Wrong DATATABLE.type 529 for obj [index]: != MULTILEADER. wrong class, maybe a dwg_encode_get_class() failure. Fixes several fuzzing crashes. encode: fix empty FIELD_2DD_VECTOR Fixes GH #178 null_pointer1 case encode: protect from stack under-flow From GH #178 fuzzing encode: protect some NULL pointers Fixes some GH #178 fuzzing 2019-12-30 Reini Urban indxf: fix r2007+ dwg_find_tablehandle() leaks dwg_find_tablehandle searches by name, dwg_dynapi_entity_utf8text creates fresh utf8 names, which were not freed. This fixed now most of the indxf leaks, GH #151 2019-12-30 Reini Urban free: fix more indxf leaks the underlying cause is that indxf already adds DEBUGGING classes, for which no dwg_free_OBJECT code exists. i.e. TABLE.preview (common entity data), or TABLE colors. Let dwg_free_UNKNOWN_ENT handle that and leak the rest classes.inc: formatting only 2019-12-30 Reini Urban fixup indxf, wrong NULL pair check at dwg_read_dxf the initial pair is NULL, so empty DWGs were produced. also harmonize dat opts with dwg opts 2019-12-30 Reini Urban programs leaks comments indxf: fix name "*Model_Space" free must not be constant. broken with 27a4380702667391668d4693ea7bdfdc9cf823c7 indxf: more pair NULL protections found via fuzzing indxf: protect types in dxf_blocks_read when reading mspace or pspace BLOCK's, its owners are not a BLOCK_HEADER, but BLOCK_CONTROL. Found via fuzzing 2019-12-29 Reini Urban more free indxf fuzzing fixes skip color names, not assigned yet, and failing. only free unknown if type is UNKNOWN, otherwise it will free illegal reactors, ... indxf: protect NULL pair this time in dxf_classes_read. Fixes some fuzzer cases in_dxf: improve new_object speed by 2x make ADD_OBJECT/ADD_ENTITY linear search 2x faster, by aborting on found. improve dwg_encode_get_class require more than one invalid klass->dxfname to switch over to search by index, and never do it with indxf, because there we do have the proper name already, and we just need the dynamic type Fix off-by-one class indices encode: protect from NULL klass->dxfname only relevant with fuzzed dxf data. rm .build-asan/dxf-check accidently added decode, dwg.h: add more restrict 2019-12-29 Reini Urban indxf: protect NULL pair in dxf_header_read on overflowed values. try a 2nd time then. Fixes ERROR: dxf_read_rs: RS overflow 860276 (at 314) ERROR: Invalid DXF group code: 8308 Segmentation fault (core dumped) 2019-12-29 Reini Urban indxf: protect null-dereference in dxf_fixup_header found by fuzzing dxf2dwg define 2 pline api funcs for afl-fuzz needed by dwg2ps. fix outdxf cquote buffer-overflow stack or heap, detected by fuzzing. using for cquote 2*len+1 is enough, but also protect from stack-overflow in cquote and json_cquote. encode: add missing restrict dxf <=> dwg helper harmonize helpers, analog to log. log creates a dwgread log file. dxf should create a dxf from dwg, dwg should create a dwg from dxf. free: enable indxf VALUE_HANDLE logic actually set dat->opts to detect global HULL handles, which may not be double-freed 2019-12-29 Reini Urban alive.test: skip dxf2dwg leak test this helps under asan/lsan when custom ASAN_OPTIONS are set. writers do not hang anymore. 2019-12-29 Reini Urban indxf: clear realloced buffers avoid uninitialized data and pointers, esp. for free and valgrind. indxf move_out_BLOCK_CONTROL: fix for j>1 when pspace is at entry 2 we need to avoid a classic heap-overflow XDICOBJHANDLE when add xdicobjhandle ref failed, set xdic_missing_flag dxf: support --force-free as dxf2dwg does. needed for leak debugging harmonize some ACIS ERROR newlines make: extract VALGRIND_OPTS for check-dwg-valgrind it is now overridable add LTEXEC for --enable-shared (the default) for some top test targets add dwg helper for dwg2dxf analog to dxf Maybe the name is a bit unfortunate, but it is only an internal helper free: omit Free object pointer so that all logs are diffable fix MULTILEADER.ctx.lline[] handles Support SHAPE.style_id for DXF as name [2] renamed from SHAPE.shape_no (changed API). for out_dxf look up the name from the STYLE index, for in_dxf still ignored. BTW: We still don't have a testcase for SHAPE, but the afl fuzzer was nice to create a proper one to detect this case! 2019-12-29 Reini Urban free: fix VALUE_HANDLE for INDXF NULLIFY ref only if really freed. Fixes a few leaks and double-frees. make -C src .ic: keep a physical backup, not just in git 2019-12-28 Reini Urban free: fix the dxf pair leaks before each new_object. The INDXF obj->dxfname is heap allocated, the obj->name const. Biggest part of #151 Now leftovers are mostly some dynamic dynapi strings and SPLINE callocs. 2019-12-28 Reini Urban free: more indxf leaks free pair on DXF_CHECK_EOF, DXF_RETURN_EOF. GH #151 free: work on indxf leaks Keep the first BLOCK_HEADER name static, as all the others. See GH #151 adjust gen-dynapi.pl line numbers +1 not -1 2019-12-27 Reini Urban dxf2dwg: add experimental --force-free option to be able to debug into dwg_free leaks, as found by valgrind outdxf: protect from NULL HATCH.boundary_handles found via fuzzing outdxf: fix some dxf_tables_write null-dereferences leading to fuzzing crashes outdxf: fix 1 dxf_classes_write null-dereferences leading to fuzzing crashes outdxf: fix 3 header null-dereferences leading to fuzzing crashes No -Wformat-truncation warnings anymore. Add an assert. The old code ran out of var-tracking size, but the assert now makes it clear. indxf: fix some nonnull warnings Fix some -Wunused-but-set-variable detected by clang-analyzer Avoid -Wformat-truncation, add RETURNS_NONNULL attribute mark dxf_format() and dxf_codepage() as __attribute__((returns_nonnull)), avoiding clang warnings warning: null format string [-Wformat-truncation=] snprintf (buf, 255, _fmt, value); indxfb: fix dxf_read_rd copy pasta indxf: fix -Wformat with 32bit 2019-12-26 Reini Urban indxf: init MLEADER counts in REPEAT check num_vars before accessing the array, which might still be NULL. esp. with indxf indxf: fix DXF_*_EOF logic treat NULL pair as EOF, and return immediately indxf: support 3DSOLID.history_id and for all its children (AcDb3dSolid). r2007+ indxf: fix color.alpha at least since r2007 alpha is seperately at 440 indxf: dxf_read_pair() pair leak indxf: dxf_thumbnail_read pair leak indxf dxf_expect_code: use-after-free and -Wnull-dereference fix decomp leak in read_2004_compressed_section with empty sections fix preR13 PREP_TABLE memory leak fix dwg2dxf filename_out memory leak fix some dwg_api point memory leaks refactor perl5 bindings set proper -I and -L paths, create LibreDWG.c not swig_perl.c fix dwgwrite outfile memory leak fix 2 dwgrewrite filename_out memory leaks indxf: fix postprocess_SEQEND memory leak indxf new_object: -Wnull-dereference (the last one) indxf new_LWPOLYLINE: fix 91 vertexids type detected by scan-build in_dxf add_MULTILEADER_leaders: fix -Wnull-dereference Harmonize out_dxfb.c with out_dxf.c Fixes GH #173, esp. add the new mspace improvements. in_dxf add_MULTILEADER_lines: fix -Wnull-dereference dxf_header_read: add a strlen nonnull check dxf_tables_read: -Wnull-dereference abstract DWG_OPTS for dat->opts and dwg->opts use constants 2019-12-26 Reini Urban remove in_dxfb.c GH #134 add some is_binary logic to in_dxf.c use dat->opts flag 0x20 for DXFB reduced size of the .so from 30521368 - 30260552 = 260816 byte. It should be a bit slower though, but many indxf funcs are now static, and there are no silly code duplicates anymore. Closes GH #134 2019-12-26 Reini Urban in_dxfb.c: merge with in_dxf.c add all the missing logic. See GH #134, we really wanted to avoid that code duplication. 2019-12-26 Reini Urban in_dxf: pair->value.s nonnull as version Argument with 'nonnull' attribute passed null in_dxf: STRADD pair->value.s nonnull Argument with 'nonnull' attribute passed null STRADD with NULL pair->value.s sec_dat.chain nonnull Argument with 'nonnull' attribute passed null Harmonize read_2004_section_preview with r2007 variant, sec_dat.chain could be NULL Type casting inconsistency #174 Avoid overflows by casting to the larger type, zero-extended 2019-12-25 Reini Urban examples: add unknown.pi to EXTRA_DIST make unknown didnt work in checkouts with picat Makefile: refman-pdf is not a prime-target and does not work 2019-12-25 Reini Urban Release 0.9.3 2019-12-25 Reini Urban enable ax_restrict re-format docs: autoconf-archive is pretty strict gcc-9.2 on fedora has it fixed. enable it. we do have several small inlined functions with loops on arrays, so it might affects us. See GH #141 2019-12-25 Reini Urban fix -Wcpp warning with AX_ADD_FORTIFY_SOURCE protect from invalid preR13 table numbers various int overflows. Fixes GH #176, case 8. add more preR13 error handling. Fixes the remaining GH #176 case 9 more illegal preR13 protections and optional byte overflow counter to abort >200 errors. Helpful in fuzzing, but not really useful for libs, the program must install a SIGABRT handler then. Fixes part of the remaining GH #176 case 9 (id:000024) 2019-12-24 Reini Urban fix REPEAT overflow check for fix dwg_find_table_extname -Wnull-dereference use format(ms_printf) only on _WIN32 silences a few warnings fix theoretical strncpy truncations gcc-9 warns too much to my taste. 2019-11-07 Reini Urban geom: fix transform_OCS normalized the wrong vector, ax => az typo, worked with random stack values. fix PROXY_ENTITY.ownerhandle leak found in example r13 DWGs extnames: add documentation Closes GH #167 dwg_find_table_extname improved find more ACAD_XREC_ROUNDTRIP, not only at the first index. find the correct XRECORD via the xdic itemhandles[], no need to search the next or all XRECORDs extnames: only for r13-r14 EXTNAMES do not exist since r2000. just ignore it and return the normal layer name extnames: abstract is_extnames_xrecord and xdata_string_match, which catches now linked xrecs, which are not EXTNAMES DICTIONARY.itemhandles always i.e. also for r13 and r14, where it is needed for XRECORD EXTNAMES implement dwg_find_table_extname See GH #167 2019-11-06 Reini Urban extnames: use dwg_find_table_extname to be implemented yet prepare dwglayers --extnames see GH #167 2019-11-05 Reini Urban fixup gen-dynapi.pl for HANDLE_VECTOR_N to generate the same docs (dxf 331) 2019-11-05 Reini Urban fix SORTENTSTABLE leak HANDLE_VECTOR does an overflow check, with resetting the num_ents field. Which does not free the sort_ents then anymore. Note that SORTENTSTABLE.ents can be empty in some dwgs. They are filled with NULLs then. 2019-11-05 Reini Urban fixup dwglayers, add asserts and flush each layer line. It can error during the loop. fix dwglayers on empty layer_control.entries. Closes GH #166, thanks to @fpmalard for the testcase fflush (stdout) before dwg_free on programs printing to stdout. They might fail there. See GH #166, thanks to @fpmalard. 2019-10-31 Reini Urban update TODO 2019-10-30 Reini Urban rm README-alpha already beta since 0.9 more geom.h use use M_PI change extrusion types from 3DPOINT,3BD to BE 2019-10-30 Reini Urban dwg2SVG: add POLYLINE_2D and LWPOLYLINE basic lines only. no arcs (bulges), no other curve_types (spline, bezier) no widths. Closes GH #137 2019-10-30 Reini Urban fix geom normalize div by zero add programs/geom.c utilities for dwg2SVG and dwg2ps dwg2SVG: add transform_OCS See #165 add OCS doc Closes #165 2019-10-29 Reini Urban add FIELD_BE logging to decode some .x values are flipped when extrusion.z is -1.0. see GH #165 more fixup illegal bitsizes document codepage names 2019-10-28 Reini Urban set aligned_access_required on ubsan fail with illegal section_info num_desc2 with a fuzzed dwg. cannot continue then fix bit_read_RC overflow found when fuzzing on 32bit. fixup illegal bitsize's. 2019-10-28 Reini Urban Release 0.9.1 Implement ALIGNED_ACCESS_REQUIRED bit_convert_TU when the wstr pointer is unaligned. E.g. for ubsan check for ALIGNED_ACCESS_REQUIRED stricter risc machines, like sparc, alpha. but also settable for intel or with ubsan. 2019-10-27 Reini Urban fix r2007 Invalid section->pages[%d].*size via fuzzing. skip invalid sections. replace assert with proper error fix xdata hang on buf overflow. check for advance fix info->sections[0] NULL deref found by fuzzing fix xdata hangs error with wrong xdata types fix decode_R13_R2000 stack-overflow with too many sections (i.e. 8) 2019-10-26 Reini Urban fix VECTOR_CHKCOUNT overflow e.g. with num_owned = 2147483899 * unsigned, overflowing to a low int (512) fix divide by zero in VPORT.aspect_ratio fix ub in bit_reset_chain overflow ubsan runtime error: addition of unsigned offset to 0x00010a401800 overflowed to 0x00010a4014c1, asan fuzzing. fix decode_3DSOLID VECTOR_CHKCOUNT where obj->nam may be realloced but not cleared, resulting in an invalid free 2019-10-25 Reini Urban fail with VALUEOUTOFBOUNDS ent num_reactors usually only found when fuzzing fix #162 decompression DOS check while loops for exhaustion. fix #163 header.section[SECTION_HEADER_R13].size - 34 overflow, with empty size. Illegal fuzzed dwg only. fix #162 Null pointer dereference in check_POLYLINE_handles fuzzed DWG only, not a real one 2019-10-24 Reini Urban skip test with x86_64-mingw-w64 gcc-9.2.0 miscompilation in bit_read_H with val[i]: (%rbx) being dat+1. Previous compilers are fine. similar errors also in other packages. warn about this problem, to use an older working compiler. 2019-10-24 Reini Urban fix section[].size overflow Fixes GH #160 fix Overflow section_array_size dos Only allow a certain amount of overflows, to repair it later. Fixes GH #161 fix decode 2004 literal_length overflow Fixes GH #159. Check the initial literal_length also, not only in the loop fix Null pointer dereference in decode_R13_R2000 #158 unit-testing: fix -Wunused-function warning ok is unused in dynapi_test.c probe for attribute format(ms_printf) 2019-10-23 Reini Urban decode: fix more leaks on DWG_ERR_VALUEOUTOFBOUNDS found by e.g. GH #156 fuzzing testcases, bailing out early on REPEAT_CHKCOUNT decode: fix thumbnail sentinel mismatch leak detected by GH #156 bits_test: fix Conditional jump or move depends on uninitialised value bitchain.opts was left uninitialized on the stack, needed for LOG_TRACE probe for attribute format(gnu_printf) bits_test: more leaks all now bits_test: fix leaks fix bit_read_4BITS off-by-one for the first bit. Only detected by mingw-w64-x86_64 2019-10-22 Reini Urban fix win32 multiple definition of `dwg_version_type in test/unit-testing/decode_test add dwg_version_type() a printable release version string _FORTIFY_SOURCE: and add -fstack-protector on mingw32-w64 for broken _FORTIFY_SOURCE. This adds -lssp (needed for _FORTIFY_SOURCE) and is useful in its own acount. 2019-10-19 Reini Urban fixup prev. ax_add_fortify_source [] needs to be quoted. use something else. 2019-10-19 Reini Urban fix AX_ADD_FORTIFY_SOURCE for msys2 msys2 bug with headers-git-7.0.0.5546.d200317d-1 either add -fstack-protector for -lssp to be added, or omit adding -D_FORTIFY_SOURCE=2 to CPPFLAGS. See https://github.com/msys2/MINGW-packages/issues/5868 actually try to link it, to catch it 2019-10-18 Reini Urban fix REPEAT -Wtype-limits checks uint32_t has only 4 byte. check for signedness overflow. indxf: protect NULL derefs detected by mingw gcc only fix win32 decode logging eed wstring 2019-10-18 Reini Urban dwg2SVG: honor TTF font styles => Verdana or Courier. Translate font-styles to svg font-families. Use Courier for all non-ttf fonts, and Arial or Verdana for ttf fonts. There's no SIMPLEX or COMPLEX in svg imho. Closes #156 2019-10-18 Reini Urban fix leak in r2007+ dwg_ref_tblname logging a temp. utf8 handle ref name 2019-10-08 Reini Urban spec: LIGHT.shadow_map_size see unknown LIGHT.pi unknown: minor fixes 2019-10-06 Reini Urban Release 0.9 2019-10-05 Reini Urban indxf: fix VIEW_CONTROL 70 -1 which appears in the wild. fix get_next_owned_entity esp needed for dwg2dxf, which missed the very last block entity. Fixes GH #143, thanks to @soundd1 dxf: fix BLOCK.base_pt take it from the BLOCK_HEADER. see GH #143 fix bit_convert_TU for >U+0800 a major blunder. wrong order of bytes AND wrong numbers. thanks to some chinese examples with chinese application names, esp. GH #109 and #143 2019-10-04 Reini Urban fix int overflows detected by lgtm dxf: VALUEOUTOFBOUNDS CellStyle.num_borders overflow with gh143/testBlock regen broken 2000/TS1.dxf example it could not even be loaded by acad dxf: fix FIELD_BSd formatting %6i, not %d. E.g. $DIMLWE bindings: add dynapi 2019-10-04 lorenz swig: swig4 needs "stdint.i" to be included (PR #153) 2019-10-02 Reini Urban dxf: encode all r2007+ strings as utf-8 see e.g. GH #109 and #143 dxf-check: we start with dxf not dwg dynapi: add dxf for VISUALSTYLE.unknown_float45 even if unused in DWG indxf: add_LTYPE_dashes spec: restrict POLYLINE_MESH to max 100000 vertices alloc failure with 32bit fuzzing there dwg2SVG: ignore empty pspaces We also assume all refs are resolved already. Fixes GH #109 decode: fix more -Wsign-compare and -Wtype-limits decode: fix a -Wsign-compare fuzz: skip corrupt classes avoid strcmp on NULL fuzz: fail on corrupt es.fields.address protect from overflow segv, found via fuzzing. Turn asserts into an error fuzz: more section repair protection segv on i = 0 with [i - 1] 2019-10-02 Reini Urban fuzz: protect from dat overflow ERROR: bit_read_RC buffer overflow at 18446744073709549374 bits.c:103:14: runtime error: addition of unsigned offset to 0x7ff41c4a9800 overflowed undefined-behavior dont advance already overflowed pointer 2019-10-02 Reini Urban decode: fix NULL strcmp found via fuzzing, with corrupt input decode: fix double-free with corrupt compressed sections. Found via fuzzing fixup htmlescape in src/out_json.h this is not library specific, just for helper programs. moved to programs/escape.h 2019-10-01 Reini Urban new programs/escape.c,h extract from out_json, because we dont want to add these to the API 2019-10-01 Reini Urban dwg2SVG: htmlescape strings and names and for widestrings escape to hex. Also protect from a few NULL strings. Closes GH #149 2019-10-01 Reini Urban spec: splice TABLECONTENT into TABLE r2010+ as macro, not to duplicate it. spec: merge TABLECONTENT into TABLE r2010+ a call will not work. TABLECONTENT is only an object, not an entity and has totally different offsets. Either put it into a macro or duplicate it. 2019-10-01 Reini Urban indxf: resolve_postponed_object_refs some TABLE/BLOCK/OBJECT field handles neeed to be resolved at the end, when the blocks and tables are all read. e.g. INSERT.block_header and various layer or other entity names Fixes GH #150, INSERT.block_header missing 2019-10-01 Reini Urban encode: fix VPORT.VIEWMODE bit_write_4BITS was broken, and the indxf calculation was missing. simplify the 4BITS reader and writer, add proper bit logging. indxf: set UCSFOLLOW and VIEWMODE 2019-10-01 Reini Urban decode: better pt logging print the proper point types, not just RD or BD indxf: fix VPORT.aspect_ratio r13+ aspect_ratio is calculated, the internal field really is VPORT.viewwidth. added to the API. calculate both. indxf: more default points values e.g. VPORT.view_target.z (GH #150) 2019-09-30 Reini Urban indxf: fix default points values e.g. WIPEOUT.uvec (GH #150) indxf: IMAGE,WIPEOUT.imagedefreactor is code 3 not 5. 2019-09-30 Reini Urban change DIMASSOC, indxf: add_DIMASSOC change the spec a bit. H 331 seems to be repeated with main_subent_type 73, H 332 with intsect_subent_type 74 The other handles seem to be superfluous. Change the order of order of some fields to allow proper dxf roundtrips. (just rotated_type fails still) Only the indices with the bit set in associativity are filled. (no change) 2019-09-30 Reini Urban indxf: add_PERSSUBENTMANAGER, add_ASSOCDEPENDENCY but some of them are not yet encoded. encode: implement encode_3dsolid for most cases no encryption needed. decode has it already, indxf also indxf: add postprocess_TEXTlike and MTEXT defaults to minimize defaults to dataflags, and set default style handle. 2019-09-29 Reini Urban json: work on TABLE segv when it errored on decode TABLE after num_owned. Don't decode a r2010+ TABLE/CONTENT object header twice, only process the fields, because it's an entity afterall, not an object. But now we need to share the struct fields somehow. 2019-09-29 Reini Urban indxf: add_TABLESTYLE for the subfields. We need a seperate Dwg_TABELSTYLE_border from Dwg_BorderStyle because of two major differences: BL visible vs B invisible, and BL vs BS linewt. 2019-09-29 Reini Urban harmonize REPEAT names _ adds idx C does no checks N does constant times (else _obj->times) (and cannot reset times to 0 on error) F does not calloc/free spec: VALUEOUTOFBOUNDS TABLEGEOMETRY cell.num_geom_data as it happens in example_r13.dwg more DEBUG: unstable TABLESTYLE promote TABLESTYLE from debugging-only to unstable (just r2010+ is unhandled). 2019-09-28 Reini Urban more DEBUG: check CELLSTYLEMAP overflow samples with too small CELLSTYLEMAP survive now roundtrips. fix MATERIAL color types decode: check for bits string overflows encode: better point logging indxf: fix new_LWPOLYLINE no bulges unless needed. properly encode flags from dxf, honor defaults. e.g. no const_width if 0.0. 2019-09-28 Reini Urban spec: add TABLESTYLE at least until r2010. reformat wrong dwg_api. also fix a few minor ASSOCACTION decl problems. 2019-09-27 Reini Urban DOCUMENTOPTIONS is alias for CSACDOCUMENTOPTIONS dxf, log: shorter make 2019-09-27 Reini Urban encode: fix entity bitsize calculation set START_HANDLE_STREAM for entities in COMMON_ENTITY_HANDLE_DATA. Fixes GH #142, the very first version which imports most entities. 2019-09-27 Reini Urban indxf: comments, logging only dxf-check for 2000/TS1 use the proper basename indxf: encode OLE2FRAME.data 310 2019-09-27 Reini Urban indxf: fix new_MLINESTYLE_lines forgot to set MLINESTYLE.num_lines also improve some obj->type checks. by int, not by name 2019-09-27 Reini Urban api: add dwg_find_dicthandle fixes dwg_find_tablehandle for dicts. We need to search for the name in the dict given by the first NOD search. Not just returning this dict. With MLSTYLE we need to return the MLINESTYLE object ref. Also use the absolute refs, even if dict handles are code 2, not 4. 2019-09-27 Reini Urban indxf: cosmetics only HEADER.CMLSTYLE is still pointing to the wrong MLEADERSTYLE object, not MLINESTYLE. decode: more stable eed decoder with overflow, e.g. when dat does not advance error earlier. avoid endless loops on eed decoding errors. indxf: more eed size fixes the final string \0 does not count. It is just allocated for better logging. indxf: add DIMSTYLE defaults 2019-09-27 Reini Urban indxf: fix LAYOUT subclass conflicts groups 70 and 1 are in both subclasses. rename two LAYOUT fields: pspace_block_record => block_header, last_viewport => active_viewport. fix setting mspace_block_header and active_viewport from dxf. 2019-09-26 Reini Urban log BLOCK_HEADER.num_inserts for de,encode consistently indxf: fix BLOCK_HEADER first|last_entity to abs Fixes Reading handle 1F object type AcDbBlockTableRecord Error 34 (eWrongObjectType) Object discarded indxf: nolinks = 0 for BLOCK always add r2000 prev_entity + next_entity BLOCK, even if 0 decode eed: fix data decoding dont jump to a wrong end pos encode eed: no codepage r2007+ and add a bunch of LOG_POS dat->byte locations for debugging. indxf: collect eed sizes only add a new EED size block with a new handle. else add size to previous block encode: fix encode_eed always write the handle after each new sized data block. not just the first add dwg_find_tablehandle_silent and use it in in_dxf. not exported for now. encode: fix -Wtautological-constant-out-of-range-compare warnings. case size to long to compare same types doc: fix ENTITIES summary line doc: add Structures for EED and XDATA. Maybe more special structs later indxf: add postprocess_BLOCK_HEADER Closes GH #146 encode: - logging prefix for patched sizes 2019-09-25 Reini Urban indxf: more abs/rel ownerhandle logic dwg_add_handleref: when searching for existing refs, DICTIONARY, XRECORD or class may need to be relative. skip the search for existing absolute ref then. < GROUP needs to be abs, MLINESTYLE e.g. not, is rel. 2019-09-25 Reini Urban indxf: resolve class types earlier via dwg_encode_get_class, from encode. improve the abs/rel ownerhandle logic for DICTIONARY and XRECORD sample_2000.dxf: add THUMBNAILIMAGE section 2019-09-24 Reini Urban indxf: ownerhandle abs logic abs for all old-style types < 500 rel for all classes WIP dwg_encode_get_class indxf: WIP skip eed[0].size for handles still wrong though indxf: preserve eed[0] handle and size. handle is unfortunately stored at eed[0], and was cleared by the first non-handle value at eed[0]. indxf: no SEQEND nor ENDBLK prev entities indxf: no 2x XRECORD.ownerhandle xdata then encode: prefer class->number over old type When a class with the same type exists, such as ACDBPLACEHOLDER or OLE2FRAME, prefer the varies type (>500), over the fixed type. Fixes Error 34 (eWrongObjectType) indxf: better entity defaults entities bordering to SEQEND, ENDBLK have nolinks. set ltype defaults indxf: fixup BLOCK_CONTROL[0].entries[0] wrong num_entries indxf: flip logging type code indxf: fix duplicate handle for BLOCK_HEADER.*Model_Space it is allocated at objid 0 for minimal DXFs. Reuse the pre-allocated object then. 2019-09-23 Reini Urban dxf: fix wrong INSERT.block_header 2 (name) Thanks to @soundd1 detecting this bug. Closes GH #143 dxf: fix wrong COLOR.byblock GH #143 index 256 == bylayer index 0 == byblock skip bylayer for dxf, and index & 255 turned bylayer into byblock. Thanks to @soundd1 detecting this bug decode: try to repair the section_info_id WIP See GH #144 2019-09-23 Reini Urban WIP decode: more r2004 section map checks try to fix GH #144. allow negative Dwg_Section.size ?? ignore overlarge Section id > last_section_id. added various consistency checks and a section_map_address repair. 2019-09-23 Reini Urban json: no 0x%x numeric formats they cannot be parsed api: change Dwg_Section address to uint64_t It is read as such. see GH #144 for a testcase dwgwrite: fix -y overwrite write the dwg then alive.test: timeout 10s fails on my mac air with asan and 2 larger dwgs, example_2013 and example2018 with dxf2dwg indxf: set entities entmode 2 for mspace (default) indxf: set entity codes 6, 390, 347 BB ltype_flags, plotstyle_flags, material_flags 2019-09-22 Reini Urban indxf: fix init of points with extrusion setting pt.z to 1.0, i.e. LINE start.z indxf: fix EED for points and handle add proper logging indxf: but leave room for one active entry indxf: fixup entries vs num_entries no NULL entries[] allowed. esp. VIEW_CONTROL entries are mostly NULL. encode LTYPE.strings_area if empty All TF, TFF strings must be dumped, even if NULL. Fixes Reading handle 14 object type AcDbLinetypeTableRecord Error 67 (eDwgObjectImproperlyRead) Object discarded encode: no NULL handles, always with code Fixes Recover: error eWrongObjectType reading Header. spec: fixup LTYPE_CONTROL.bylayer and byblock mixed up. 2019-09-22 Reini Urban indxf: fixup HEADER.CMLSTYLE MLINESTYLE, not MLEADERSTYLE. Also don't change existing ref.code to 5, recreate if not 5 already 2019-09-22 Reini Urban indxf: fixup HEADER.HANDSEED->code = 0 indxf: no NULL ownerhandle, 4.0.0 then encode all ownerhandles. do relative offsets only for valid absref targets. indxf: encode HEADER.FLAGS and CELWEIGHT add reverse dxf_revcvt_lweight(), add more HEADER defaults which dont appear in most DXFs 2019-09-21 Reini Urban silence FIELD_HANDLE names add 2 new API funcs: dwg_ref_object_silent, dwg_resolve_handle_silent (was static) 2019-09-20 Reini Urban dxf: fix xdata 3DPOINT DXF fixes XRECORD: 10 group not followed by 20 group dxf: fix DICTIONARY bug with dupl. itemhandles dxf: skip dupl. 330 ownerhandle already via common_entity_handle_data now 2019-09-20 Reini Urban decode: log bwd handleref names to log fwd handles we would need to scan all object types in advance, and then a 2nd time for its fields This might catch at least some wrong H refs. 2019-09-20 Reini Urban decode: macro aesthetics shorten a few vars. add clang-format directives example_2000.dxf: add THUMBNAILIMAGE to have closer numbers in the generated DWG dxf: ATTDEF.prompt 3 is DXF mandatory not just SINCE (R_2010) 2019-09-19 Reini Urban abstract set_handle_size for longer handles indxf: reactors[] always absolute, but the others, esp. ownrhandle always relative XRECORD logging spec free aesthetics 2019-09-19 Reini Urban GH #85: COMMON_ENTITY_HANDLE_DATA earlier Since r2007 we have a seperate hdl stream, which we can call at the beginning already. This enables the removal of the extra handles loops in the spec. But just r2007+, before those handles are still after the normal fields. Needs a special free logic there, not to delete ctx.leaders before the 2nd loop. free: combine common_entity_data with common_entity_handle_data, just call them in series. 2019-09-19 Reini Urban fix MULTILEADER leak in 2nd REPEAT loop for the handles, when the leaders field was already removed by the 1st loop. This will be properly fixed later, when we seperate the hdl_dat stream earlier from the obj stream, to process both at once. The text stream str_dat also. See GH #85, branch work/gh85-common 2019-09-18 Reini Urban encode: set xdicobjhandle to (3.0.0) not NULL when empty on r13-r2000 decode refs not as NULL handle To store the original handle.code on encode. more logging aesthetics dwg_bmp: better BMP offset logging decode: fix FIELD_RSx logging encode: fixup type with dwg_encode_variable_type need the proper class id. Fixes ACAD eNoClassId and eWrongObjectType decode preR13: strncpy overflow tbl->name has only 64 byte fix dwgrewrite leaks encode: Thumbnail even with empty HEADER.thumbnail_address The address may be computed. parse the thumbnail data mostly for logging dwgrewrite: overwrite existing -rewrite.dwg log more types each read and write should be logged ideally. not yet for eed, xdata, sentinels, class. 2019-09-17 Reini Urban indxf HEADER strings they disappeared in encode FIELD_TV with IF_ENCODE_FROM_EARLIER. indxf: log HEADER dxf codes also. 2019-09-17 Reini Urban add proper FORMAT_RLx ditto add RSx type encode header: set is_maint defaults decode: Clearer Handles logging encode: fix Handles CRC_LE The little-endian variant, not BE. indxf: reformat prev. indxf: dwg_find_tablehandle is already case-insensitive since 7222ec07edb48ab298a3d90f66f5bcb23c1ef245 indxf: seperate LTYPE bylayer/byblock into its own fields in LTYPE_CONTROL. Like with BLOCK_CONTROL model/paper_space before encode: fix bitsize calculation indxf: set tablerecord->xrefref = 1 as default encode: fix object CRC fix bitsize_pos logging, fix object address for the size calculation (dxf only). 2019-09-16 Reini Urban log the CRC sizes also encode: fix bit_write_CRC logging off-by-2 dxf: add dxf-check similar to dxf-roundtrip.sh via TeighaFileConverter, but the other way round, for dxf2dwg. indxf: seperate {model,paper}_space into its own fields set the proper BLOCK_CONTROL fields. encode: fixup encode_patch_RLsize the size doesn't contain itself. indx: set klass->number, fixup ACDBDATATABLE in DXF DATATABLE is ACDBDATATABLE, in DWG not. fixup dwg->num_classes, to fix writing the last class. indxf: fix HEADER points and add some more defaults dxf: add all the missing codepages and its names 2019-09-15 Reini Urban dwg_find_tablehandle: find in DICTIONARY when the ctrl object is a DICTIONARY. Finds HEADER.CMLSTYLE indxf: find more HEADER DICTIONARYs LAYOUT, PLOTSETTINGS, PLOTSTYLENAME, ... with an ACAD_ prefix in the NOD indxf: resolve more header handles resolve_postponed_header_refs also had a bug. search names case-insensitive. need DICTIONARY objects for CMLSTYLE. indxf: add IF_ENCODE_FROM_EARLIER_OR_DXF set dwg->opts 0x20 on indxf, and 0x30 on minimal DXF, to set defaults which are not defined in a DXF decode: fix FIELD_NUM_INSERTS when num_inserts RC > 1, let it count. fixes GH #44 to accept one inserts[vcount][0] entity. compared to gh44-error.dxf: there's only on num_inserts BLKREF there, so it looks correct now. encode: better minimal DXF support set dat->from_version lower to trigger IF_ENCODE_FROM_EARLIER defaults. set empty header.dwg_version, app_dwg_version, codepage, and empty HANDSEED. skip AuxHeader then. 2019-09-15 Reini Urban dynapi: BE is a 3DPOINT also It could be renamed to 3BE, but that would change the API too much. This fixes heap-overflows when importing r12 DXFs, on the first 210 line. 2019-09-14 Reini Urban api: change handle sizes to long support handle sizes > 4, up to 8 byte on 64bit. as demonstrated in GH #143 they can be as large as D485E5D6 or even FD485E65F. Fixes GH #143 rename SECTION_OBJECTS_R13 => SECTION_HANDLES_R13 and dont recover offsets for illegal handleoff values yet 2019-09-14 Reini Urban decode: recover from invalid HANDLES either wrong handleoff UMC or offset [MC], which come in pairs. default to the next objects then. See testcase in GH #143. set r2000 section names (for logging). 2019-09-14 Reini Urban bit_read_UMC: default illegal handleoff to 1 not 0, and the offset from the previous size, to read the next object. But the root problem remains in bit_read_UMC. See testcase in GH #143 free: fix double-free of late added refs They were added by dxf_block_write - get_last_owned_block. This added endblk_entity is not a new ref, it already exists. It get's freed by dwg_free. free: advoid wrong warnings and skip bounds check exits. we want to free all fields common.h: fix memBEGIN, unused because broken move rad2deg to common.h define only at one place, not 3 memmem not used anymore was replaced by membits build-aux/clang-format-all 2019-09-13 Reini Urban indxf: ENDBLK,SEQEND NULL prev_entity,next_entity See GH #142 indxf: default color.index = 256 ByLayer and log CMC spec: reformat XRECORD misleading identation encode: xdata forgot the type RS encode: log more fields 2019-09-13 Reini Urban encode/indxf: NULL HANDLE is NULL and not a ref to 0. harmonize logging of it. 2019-09-13 Reini Urban indxf: reverse XRECORD.xdata order push to end of list, not front encode: log XRECORD xdata 2019-09-12 Reini Urban dynapi: regen doc spec: many more VALUEOUTOFBOUNDS checks and esp. reset the wrong num_ fields. indxf: set prev_entity, next_entity now common_entity_handle_data is complete 2019-09-12 Reini Urban fix -Wnull-dereference, add SAFEDXFNAME e.g. when logging HEADER or SUMMARY there is no obj. also for r2007 strings, there is no obj->has_strings there Only detected by gcc -O2. 2019-09-12 Reini Urban indxf: reset entmode for each block otherwise all ents end up in Paperspace. unify object-map logging log the Handleoff properly encode: fix the Object-Map Handleoff is the offset from the previous handle, default: 1, the next handle. With deleted objects there are holes. Use the proper types: UMC (unsigned) and MC. encode: rename loop indices to i 2019-09-11 Reini Urban encode: fix omap sorting use a proper insertion sort, add an init pass indxf: init BLOCK_HEADER *Model_Space .1F log: print section addresses as decimal, not hex encode: add AuxHeader, minor improvements abstract encode_patch_RLsize(), add auxheader defaults fix header.section[0].size calculation (not in dwg_encode_header_variables) indxf: calc. XRECORD.num_databytes acad complained about missing XRECORD data: Error 151 (eOutOfRange) Object discarded 2019-09-10 Reini Urban dxf2dwg: overwrite existing files -Wincompatible-pointer-types-discards-qualifiers indxf: resolve_objectrefs the object_map handles. TODO There are still many holes and duplicates in there improve dwg_model_space_object and fail when it fails, mostly with dxf2dwg dwgs dxf: write to versioned dwgs 2019-09-10 Reini Urban indxf: pass dxfname through so we don't need to resolve klassnames later. This dxfname is from the 0 NAME section in the dxf. Also update dxfb_blocks_read from ascii 2019-09-10 Reini Urban encode: support dwg_encode_get_class aliases though it's still very stupid to do it twice. classes.inc should be enough for a linear search for dxfnames. set the proper obj->dxfname. Avoid writing to dat->chain[0] on empty obj->bitsize_pos 2019-09-10 Reini Urban encode: fixup padded obj->size Fixes off-by-one Wrong object size warnings encode: no 2x object CRC, add asserts TODO: someone is still writing to dat->chain[0] 2019-09-10 Reini Urban restrict OFFSETOBJHANDLE code to 4 create relative offsets only for code 4. support code 10 and 12 with offsets < 256, size 1. 2019-09-10 Reini Urban encode: minor improvements avoid wrong Expected a CODE 3 handle, got a 6 warnings. Allow relativ offsets (TODO: only 4) 2019-09-10 Reini Urban indxf: read BLOCKS The previous TABLES section already has the BLOCK_HEADER.entries. Link it to the block_entity, endblk_entity, first_entity, last_entity. Set entmode (mspace, pspace) for all the block entities. Fix dwg_ref_object for relative refs, when ref->absolute_ref is known. Fix dwg_ref_object to don't set ref->obj on dirty_refs (as in the importer). Closes GH #133 2019-09-10 Reini Urban indxf: fix Invalid entity type BLOCK_HEADER, wanted BLOCK_RECORD dxf calls the BLOCK_HEADER BLOCK_RECORD. use the proper obj->name in {BLKREFS dxf: minor POLYLINE/VERTEX field fixups add COMMON_ENTITY_POLYLINE.has_vertex 66, add VERTEX_PFACE_FACE.flag 70, print and accept more DXF POLYLINE_* elevation points. indxf: search SEQEND.owner with indxf: fix postprocess SEQEND was pretty broken. Closes GH #138 indxf: store owner handle in map which fixes postprocess_SEQEND, because we can now find the owner indxf: fix num_reactors improve add NULL handleref always set xdic_missing_flag indxf: set NULL xdicobjhandle for r2000 indxf: set xdic_missing_flag needed to avoid accessing the NULL xdicobjhandle encode: add 2013+ has_ds_binary_data yet unused. set calc. bitsize 2019-09-09 Reini Urban indxf: postprocess SEQEND and its owner. set the owned[] handles. Fix setting ownerhandle, reactors and xdicobjhandle for entities. See GH #138 WIP owner->ownerhandle 2019-09-09 Reini Urban preview is embedded in sentinels dwgbmp: support optional 2nd arg bmpfile as documented dwgbmp: fix for 64bit on 64bit long is wrong, need BITCODE_RL sizes. decode Preview section to dwg->thumbnail with some consistency checks (failing still). This enables dwgbmp for all 2004+ dwgs. 2004+ resort sections: classes before handles, and summary after header. similar to 2000 free DICTIONARY FIELD_VECTOR_T aesthetics only 2019-09-09 Reini Urban fix obj_handle_stream and VECTOR_CHKCOUNT the streams are already restricted from 0 to size, independent of obj->address. pass the right stream to AVAIL_BITS. Fixes many overflow checks, esp. GH #132 08.dwg 2019-09-09 Reini Urban read_2004_section_handles: fix oldpos wrong check. we advance hdl_dat.byte for the handles, not dat. also check GROUP.num_groups overflow (#132 08.dwg) 2019-09-09 Reini Urban decode: fix R2004_section_map int overflow causing bytes_remaining switch from +8 to -8 but unsigned. Fixes the crash from #132 with 00.dwg Closes #93 needs int64_t, but we already required that earlier (RLL, BLL types, ...) 2019-09-08 Reini Urban probe for broken restrict new AX_RESTRICT probe. rust reports gcc broken from 5 - 10, but I can only confirm clang 6-8 failing. gcc should not be used since 9 for other reasons. Disabled since we don't have short restrict loops yet. Closes GH #141 2019-09-08 Reini Urban indxf: fix Invalid UNDERLAY field scale_flag error check of this field exists, without silencing the loglevel indxf: avoid Unknown DXF code 71 for DIMSTYLE_CONTROL warning. for the default DIMSTYLE_CONTROL.num_morehandles = 0 case indxf: more HATCH 97, 330 boundary_handles also for polyline_paths indxf: accept r13 SAVEIMAGES is present in some r13 DXFs indxf: fix MTEXT crash with empty num_column_heights with LCAD_libereco_R2000.dxf 2019-09-08 Reini Urban indxf: fix add_MULTILEADER_lines i++ fixes heap-buffer-overflow on wrong line.color. bump for each new point. Also support rgb colors. 2019-09-08 Reini Urban indxf: skip yet unsupported minimal DXF indxf: fix dxf_expect_code heap-use-after-free indxf: skip ASSOC2DCONSTRAINTGROUP stack-buffer-overflow on unsupported fields 2019-09-07 Reini Urban indxf: simplify the summaryinfo texts indxf: set the summaryinfo texts abstract ASSOCACTION from subclass AcDbAssocAction for three ASSOC objects: ASSOC2DCONSTRAINTGROUP, ASSOCNETWORK, ASSOCACTION dynapi: more subclass structs and DXF values parse the stacked .spec REPEAT blocks and defines also. renamed some subclass structs to match the types. 2019-09-06 Reini Urban dynapi: all subclasses + summaryinfo more 2004 section stuff rename vba_proj_address to vbaproj_address. shorten dwg_find_tablehandle free: fix summaryinfo leaks dxf: move last 4 HEADER vars to summaryinfo 2019-09-05 Reini Urban decode_2007: support uncompressed sections add summaryinfo decode: support uncompressed sections summaryinfo. rename dwg->header.summary_info_address to summaryinfo_address rename dwg->header.thumbnail_addr to thumbnail_address. api: add TIMERLL type raw, unencoded 2xRL julian date, for summaryinfo decode: add AcDb:SummaryInfo for the 4 new HEADER variables 2019-09-04 Reini Urban debug: add 4 new HEADER texts, fix some DEBUGGING classes TITLE, SUBJECT, AUTHOR, KEYWORDS are at least set by DXF, but we have no location for them in the DWG yet doc: dxf2dwg default writes to r2000 now later when encode supports all versions, it will be the DXF version indxf: resolve_header_dicts and fix an utf8 bug in dwg_find_dictionary (r2007+) api: harmonize DICTIONARY_NAMED_OBJECT names LAYOUTS => LAYOUT, PLOTSTYLES => PLOTSTYLENAME, MATERIALS => MATERIAL, COLORS => COLOR. 2019-09-04 Reini Urban api: fix Empty header_vars table LAYER... Search and set HEADER.*_CONTROL_OBJECTs, via added dwg_find_table_control() and dwg_find_dictionary(). These return only a ref, not the object, as the objects are still moving. (used only during encode/import) Export add_handle and add_handleref with dwg_ prefix. Trace the DICTIONARY texts 2019-09-03 Reini Urban api: add ANNOTSCALEOBJECTCONTEXTDATA object for the various ACDB_nameOBJECTCONTEXTDATA_CLASS DXF objects. They all seem to be based on the AcDbObjectContextData and AcDbAnnotScaleObjectContextData subclass, but some seem to have more. WIP indxf: simplify DXF_RETURN_ENDSEC and 0 loops DXF_RETURN_ENDSEC ends with an if block, we can do an else here break the inner 0 loop for unhandled objects. indxf: support more LWPOLYLINE fields and don't report common found handles (e.g ltype) as not found. indxf: search existing handlerefs with the same code and value. dont create fresh refs for everything only for new owners, not refs indxf: improve dxf_objects_read add object_alias (for all known object names) 2019-09-03 Reini Urban api: rename all linetype* fields to ltype make MLINESTYLE_line.ltindex a union of index|ltype handle and have type BSd (values SHRT_MAX still: 32767, 32766) indxf: resolve MLINESTYLE.lines[%d].lt.ltype name 2019-09-02 Reini Urban indxf: fix HEADER._3DDWFPREC need a special name rule here. invalid identifier api: HEADER.TIMEZONE BL => BLd (signed) change the type. e.g. -8000 is a typical value indxf: fix $XCLIPFRAME type error ERROR: skipping HEADER: 9 $XCLIPFRAME, wrong type code 290 <=> field RC. XCLIPFRAME is 280 RC or 290 B in dynapi. Set is as a byte (RC). indxf: more subfield checks and fixes 2019-09-02 Reini Urban indxf: resolve_postponed_eed_refs to fill in eed.handle refs to APPID entries, when APPID is not yet read. Also free all the postponed arrays of hdls. 2019-09-01 Reini Urban indxf: check UPPERCASE table names also for the few standard names, when setting the header vars: BYLAYER, BYBLOCK, CONTINUOUS indxf: fix UAF with ctrl TABLE dwg->object[] might move. use the ctrl objid index instead. indxf: fix Not yet implemented EED.code 1005 indxf: add defaults before reading an object: scale, extrusion, scale_flag and after: _3DFACE.has_no_flags indxf: support scale 3DD points (with defaults) and 3DFACE.z_is_zero 2019-08-31 Reini Urban dxf: fix LEADER.dimstyle to DXF 3 ODA bug, documented there as DXF 2. also handle LEADER.points[] [10 3BD*] indxf: support MTEXT.column_heights[] [50 BD*] indxf: fix UNDERLAY and clip_verts Accept PDFUNDERLAY from dxf, fix WIPEOUT rect mode, handle realloced clip_verts, there is no num_clip_verts there, but set it. 2019-08-31 Reini Urban api: remove boundary_pt{0,1} fields indxf: handle IMAGE|WIPEOUT|UNDERLAY.clip_verts 2RD* WIPEOUT todo for images use just clip_verts[0,1] instead. set num_clip_verts = 2 then. 2019-08-30 Reini Urban indxf: add flag 4 on width.start 40 DXF does not set the flag 70 & 4 (const_width) correctly indxf: handle alt. color codes and dont print them twice indxf: MLEADERSTYLE.block_scale special case weird DXF codes indxf: handle DBCOLOR color and names DXF: fix a 430 memleak in out_dxf. indxf: rename add_dictionary_handle to add_dictionary_itemhandles docs 2019-08-30 Reini Urban add MESH entity, indxf transform matrix MEDSH with --enable-debug, but always with indxf. Unknown fields, untested. But we have a 2004/Surface.dxf and we do the indxf import for it. Support the fixed size transform matrix BD[16] and one BD[12] for indxf. Fix DXF 92 preview size for all class proxy vector data. 2019-08-29 Reini Urban indxf: add_3DSOLID_encr only ACIS version 1. version 2 with 290: 1 and 2: {000...} not yet. The DXF variant has a special quoting case for '^ ' => 'A', not in the DWG. also missing: wireframe_data_present, point_present, point, num_isolines, isoline_present, wires, silhouettes. 2019-08-29 Reini Urban api: new type BL linewt => BLd linewt (signed) to represent -1 [BLd] (ByLayer), and -2 indxf: more MULTILEADER defenses some more asserts and checks 2019-08-29 Reini Urban api: rename 2 MULTILEADER has_content* fields MULTILEADER.ctx.has_content 290 => ctx.has_content_txt and .ctx.has_content_block 296 => ctx.has_content_blk They must be outside, because content is a union of either txt or blk. 2019-08-29 Reini Urban dxf: add dxf 296 for MLEADER.has_content_block indxf: simplify LOG_ERROR save space indxf: add_MULTILEADER only missing: ctx.296 2019-08-28 Reini Urban indxf: add color.rgb fields manually. SUB fields not yet (TABLE) add dxf tool (for indxf only yet) indxf: add_HATCH indxf: add_MLINE Abstract away the MLINE logic. Either break (2), next_pair (1) or search_field (0). indxf: add_SPLINE Abstract away the SPLINE logic. Either the field is handled or not. 2019-08-28 Reini Urban decode: fix Header Section[0] CRC mismatch error always failed on r13 and r14, because of missing slack (unknown header vars). Remove HEADER.crc field, it really belongs to the section logic. Set the proper crc position, and check the slack (padding). Add the 4 final HEADER.unknown_54 - 57 fields to r13 also. Always 65535. An ODA bug, which says r14+ (maybe its R13C3?). 2019-08-26 Reini Urban bit_check_CRC: fix wrong buffer overflow check bits: where did a buffer overflow occur Note: at bit_check_CRC with r13 objects add example_r13.{dwg,dxf} created via Teigha from example_2000.dwg 2019-08-26 Reini Urban decode r13-2000: simplify CRC Clarify calculation of the header CRC, which is wrongly described in the ODA. There is no need for an xor, dependent on the num_sections. Use the simpler bit_check_CRC over bit_calc_CRC, which ensures that we don't include the CRC into our calculation (striking it out). 2019-08-26 Reini Urban api: remove HEADER.SAVEIMAGES, rename vport_entity_header SAVEIMAGES is only dumped for R13.dxf, calculate it. HEADER.vport_entity_header refers to the VPORT_ENTITY_HEADER handle. Rename it. 2019-08-23 Reini Urban indxf: upgrade POLYLINE_2D and VERTEX_2D to the appropriate subclass/ENTITY. dynapi: fix DIMENSION_common dxf 2019-08-23 Reini Urban dynapi: add 100 subclass to dwg_list_subclasses but only 2 subclasses are actually code 100 in the dxf related to our subclasses. some are enclosed into 300 NAME{ groups instead. use symbolic DWG_TYPE_* for dwg_name_types, more readable. list some more aliases and subclasses, not yet used. 2019-08-23 Reini Urban dynapi: more DIMENSION_common dxf _ORDINATE went missing. needed to add manually indxf: special-case DIMENSION first handle it as DIMENSION_ANG2LN, the largest, then change type to the actual subclass. dynapi: add subclass API to get the fields of the named subclass. Note that DIMENSION_common is implemented as subclass, not parent class. 2019-08-21 Reini Urban indxf: accept dxfname aliases but we dont upgrade POLYLINE to POLYLINE_3D, ... or DIMENSION_* objects yet. add missing entity aliases to dynapi dynapi: forgot regen for visualstyle DXF 348 2019-08-20 Reini Urban spec: harmonize FIELD_BINARY fields esp. the 310 fields. FIELD_BINARY falls back to FIELD_TF elsewhere, and is needed for dxf *and* json. json cannot print \0. json: add common_entity_data, HANDLE now a list layers, ... make handle a list of [code, value]. The code changes (owner, pointer, soft, hard), but the absolute value is the same. easier to parse. dwgwrite: fail earlier on missing input 2019-08-20 Reini Urban indxf: fix wrong MULTILEADER add_ent_preview when being the text_color 92. check the subclass. The 92 RGB value leads to Out of memory on 32bit. Also protect from various other strcpy stack overflows. 2019-08-19 Reini Urban indxf: BINARY comment why we convert to hex later, not already in read_pair dwgwrite: support -y --overwrite dwgwrite: support dxf from stdin 2019-08-19 Reini Urban dwgread/dwgwrite: -v logging we should support reading from stdin, therefore be silent on default, print only to stderr. also resolve error numbers to strings 2019-08-19 Reini Urban out_json: fix NULL handle output dwg_encode_eed: simplify add dwg_encode_eed_data, needed for indxf write encoded EED.data, not just the raw bits 2019-08-19 Reini Urban stabilize dwg_encode_eed with dxf data, where we might have no data, and certainly no raw. TODO encode from data only. This fixes writing DWGs from r12 DXFs 2019-08-19 Reini Urban simplify dwg_resolve_handle usage we silently return NULL now silently disallow hash_get 0 2019-08-19 Reini Urban dwg_find_tablehandle: always compute ref->obj (indxf) we are still constructing the objects, which move (realloc dwg->objects[]), so we cannot rely on any ref->obj. don't even set them. only compute them temporarily. This fixes now the many indxf use-after-free failures. 2019-08-19 Reini Urban indxf: support eed points and r2007 strings 2019-08-18 Reini Urban indxf: search APPID for eed.1001 but this still fails if the TABLEs are not yet added indxf: implement binary EED 1004 indxf: strdup the color.name it was never allocated. protect add_eed a bit more. memcpy is safer than strcpy. indxf: check obj/ent in add_eed theoretically they should have the same layout but some compiles do crash there. dwg: move dwg->measurement to HEADER.MEASUREMENT as header var. It is read from DXF as HEADER. This fixes indxf for it most elegantly. But we need to store it as BS, not RL, otherwise in_dxf will complain: ERROR: skipping HEADER: 9 $MEASUREMENT, wrong type code 70 <=> field RL api: rename dwg->preview to thumbnail for better seperation of the global THUMBNAIL dxf section, vs the entity preview fields. A thumbnail may contain multiple pictures, as BMP or WMF. An entity preview BMP or proxy graphics vector data. api: rename picture to preview A dwg preview may contain multiple pictures, BMP or WMF. An old entity may contain under 160 a bitmap. A new class-based variable-type entity may contain under 92 PROXY GRAPHICS vector data, to be displayed under older apps. indxf: more add_ent_picture for more variable entities (class-based). They store their PROXY GRAPHIS vector data under DXF code 92, not 160, but at the same DWG field. 2019-08-17 Reini Urban dxf2dwg: skip lsan leak checks, and dwg_free failures for now. TODO indxf: fix invalid free_3dsolid for empty encr_sat_data 2019-08-17 Reini Urban indxf: fix write exhaustion, skip lsan leak with lsan call dwg_free, but dont check leaks yet. extend the chain on object writes. fixes a valgrind problem. there are still a couple of dxf_read_pair leaks: 6363 bytes on example_2013.dxf 2019-08-17 Reini Urban dwg_write_file: set dat->opts even if loglevel is set by dwg->opts. it is used by bits at least 2019-08-17 Reini Urban dxf2dwg,dwg2dxf: check write permissions change error message on symlink. we refuse to overwrite a symlink, even with --overwrite for security reasons. ditto for -w files. we now also check for write perms, and refuse to write to non-files. 2019-08-17 Reini Urban indxf: fix eed double-free eed might be realloced, but was not set. indxf: fix find_tablehandle double-free always create a fresh new table ref, don't reuse one. we need to seperate owners from pointers. the table control is the owner, the referenced handle is a pointer. 2019-08-17 Reini Urban api: rename all table control handles to entries e.g. LAYER_CONTROL.layers => entries, APPID_CONTROL.apps => entries, BLOCK_CONTROL.block_headers => entries, DIMSTYLE_CONTROL.dimstyles => entries, ... remove all ctrl_hdlv[] special-cases, depending on different names. esp. in indxf. 2019-08-17 Reini Urban bits: add bit_(read.write)_T api switching on the version automatically. simplifies the types, if TV, TU or T. 2019-08-17 Reini Urban api: strip _handle suffix, ... from all handle fields but null_handle. harmonize some names: GROUP.num_handles => num_groups GROUP.group_entries => groups BLOCK_HEADER.insert_handles => inserts, FIELDLIST.field_handles => fields, SORTENTSTABLE.sort_handles => sort_ents LAYER_INDEX.layer => layername LAYER_INDEX.entry_handles => layers visual_style => visualstyle, live_section_handle => livesection, cell_style => cellstyle, dict_handle => dictionary, dict => dictionary 2019-08-17 Reini Urban dynapi: adjust #line indxf: support bll, add dxf_read_long but not really used yet. most picture sizes are just 4G, unsigned long. (dat->size) document dwg->measurement (0 English/1 Metric) encode: add 2NDHEADER defaults but yet unused. handles[] missing api: add BSd type for some DIMSTYLE/HEADER vars, which need to be signed json: protect from empty parent->layout_number indxf: silence Unknown DXF code for BLOCK warnings These are DXF artifacts, not in the DWG add test-data/example_r14.dxf needed for alive.test with dxf2dwg. This version does not support ACDBPERSSUBENTMANAGER nor ACDBASSOCDEPENDENCY so skip these dxf tests there. alive.test: disable TODO for dxf2dwg should not crash anymore. indxf: support common CMC [62,420,430] indxf: add_block_picture (analog) and log BLOCK_HEADER.insert_handles[] indxf: add_ent_picture the entity.picture, not the dwg thumbnail 2019-08-16 Reini Urban indxf: re-arm Warning: Ignore VECTOR Only 375 warnings now with examples_2013.dxf indxf: add GROUP.group_entries [340 H*] and set GROUP.num_handles indxf: new_LWPOLYLINE all vectors do have the same size dynapi: add 2BD_1 types needed in indxf for some objects, like LAYOUT.window_max.y, ... Improve VECTOR detection indxf: skip .z of 2D points like with SOLID dxf2dwg: adjust limitation warnings indxf: read MLINE entity with its various subentities. dynapi does not have its dxf values, which does not make sense here add DXF 46 to MTEXT.rect_height was missing. ODA specifies it indxf: read SPLINE entity at least the Bezier spline, scenario 2 dynapi: fix setting r2007+ wchar strings T types are just TV, just check for TF or 2007. find_tablehandle: check against the utf8, not the wide name. dwg_find_tablehandle: use a better temp. type just to check the _obj->name earlier indxf: protect NULL hdlv[i] in dwg_find_tablehandle some handle vector entries might still be NULL indxf: fix some handleref double-free's need to make a copy of refs. But not all yet. programs: add -y --overwrite dont overwrite existing files per default with the dxf converters. regen the manual, adjust the docs encode: patchup obj size and bitsize for DXF, to fix overflows. Many dxf2dwg dwg's can now be read. encode: use SECTION enums and calc the section[0] address and size. 2019-08-16 Reini Urban indxf: dxf_fixup_header fixup some values, like table or block refs (with proper code), and values not in the DXF. make LOG_* a block to be more useful in if () else statements. 2019-08-15 Reini Urban api: rename ACDBNAVISWORKSMODELDEF to NAVISWORKSMODELDEF 2019-08-15 Reini Urban indxf: add dxf_preview_read read the hex THUMBNAILIMAGE. also abstract away new_MLINESTYLE_lines() 2019-08-15 Reini Urban dxf2dwg: set dwg.header.from_version dxf2dwg: disable free under asan for now should be enabled to test for leaks when encode is stable enough indxf: MLINESTYLE.lines[] indxf: add LAYER.linewt, flag logic indxf: resolve VT_HANDLE handles by ref, not by name (i.e. all code > 300) dwg_encode_add_object: lookup class by name same as in dwg_encode_variable_type(). This fixes DEBUGGING objects, like CELLSTYLEMAP. indxf: add hex2bin for VT_BINARY hex string e.g. handle XRECORD 311 values dwg_encode_variable_type: lookup class by name indxf has a different class order, which breaks lookup by type/class[i]. either fixup the obj->type then (now), or resort the classes, when being read from DXF. indxf: fix classes_read logging wrong num_instances copy&pasta indxf: resolve ENTITY.layer special-case. also excempt DICTIONARYVAR from DICTIONARY* cases. fix deg2rad wrong calculation!, prev. only used in unknown/bd indxf: deg2rad angles convert angles from degree to radian indxf: fix add_dictionary_handle and simplify without using the dynapi. But the problem was setting texts [3 TV*] before to TV 2019-08-14 Reini Urban api: sync struct DICTIONARY with DICTIONARYWDFLT use the same names and offsets, for easier in_dxf. rename DICTIONARY*.text => texts, DICTIONARY.unknown_r14 => cloning_r14 DICTIONARYWDFLT.cloning_rl => cloning_r14 indxf: add text to add_dictionary_handle perl: fix out-of-tree make distcheck No rule to make target 'perl/LibreDWG.xs', needed by 'all-am' dynapi: add HANDLE_VECTOR dxf values bits: -Wmaybe-uninitialized b in bit_write_hexbits Clearly an optimizer problem, but no big deal. indxf: sync in_dxf to in_dxfb indxf: fixup add_xdata may free the original pair, avoid double-free and leak indxf: add_dictionary_handle 2019-08-06 Reini Urban indxf: XRECORD add_xdata all unknown XRECORD fields are xdata suffix: also strip other known extensions e.g. dxf2dwg would create a .dwg, not a .dxf.dwg dxf2dwg: sync with dwg2dxf allow multiple input files, silently overwrite existing dwg files in the current dir. workaround old darwin makeinfo need the texi2any version for @indentedblock Merge branch 'indxf' [GH #129] Not yet fully finished but ready for master dxf2dwg: more stability dwg_find_tablehandle can find a NULL hdlname free can run into NULL _obj->eed resolve_postponed_header_refs can run into an empty string pair indxf: add BLOCK_CONTROL.insert_handles 331 indxf: add resolve_postponed_header_refs array_push: need the code also to get to the right table indxf: fill dwg->object_ref[] via dwg_decode_add_object_ref() indxf: more object_map, HEADER handles, ... Can now write most of the entities. set the object_map from the handles, fix reading HEADER handles, rename dxf_find_tablehandle to dwg_find_tablehandle. It is not just DXF-only indxf: support 3DFACE and 3DSOLID names indxf: start testing dxf2dwg for now just the alive.text. not a functional test indxf: dxf_find_tablehandle resolve table names to handle 2019-08-05 Reini Urban index: finished reading all sections start writing the dwg index: WIP OBJECTS and ENTITIES indxf: check common_entity_fields for entities. fixes e.g. BLOCK.layer. skip old table-only specific fields for new_object() and let it search the dynapi fields instead. doc: fix some more indices Now the object appears in the new 2nd index, but for pdf not the entities in the first yet. doc: dwg_get_ => dwg_getall_ 2019-08-05 Reini Urban generate dynapi.texi for all HEADER, OBJECTS, ENTITIES and internal subfields. Not CLASSES yet. Not sure about TABLES. TODO The makeinfo for pdf index and menu generation does not work for an included file. Maybe include it via gen-dynapi.pl Closes #127 2019-08-05 Reini Urban generate src/objects.inc This attempt is much better than a polluted dwg.spec Get rid of all the hacks from the previous commit WIP indxf refactor define IS_INDXF (not DXF nor ENCODER). delete all the FIELD, VALUE and HEADER macros, as we only parse dwg.spec to get the OBJECT and ENTITY definitions but we don't care about the fields and the additional logic. more minor BLOCK_RECORD fixups search fields with the right name (and log the error). fix color.index value add VT_INT64 type to dxf/eed e.g. BLL REQUIREDVERSIONS [160] since r2013+ dynapi: fix utf8 conversion is_utf8 denotes an UTF-8 input string, not that the target may be unicode. is_utf8 is always on in ascii importers. dont convert every string pair to unicode, because some fields are just TV or TF. we need to wait for that, dynapi_set_helper does that add COMMON_TABLE_FIELDS, handle indxf BLOCK_RECORD tables ensure the same binary layout for all but the LAYER table. fix the wrong BLOCK_CONTROL.entries[] handle vector, and name confusion. fixup the seperation of BLOCK_RECORD tables to BLOCK_HEADER and BLOCK_CONTROL objects. indxf: fix table common handle vectors check and fix CONTROL.num_entries, check if in reactors or xdict or ownerhandle, implement reactors[], xdicobjhandle. dynapi: enable color.index, fix DXF indxf: read colors (always "CMC"), seperate from points api: rename VPORT.ucs_pre_viewport to UCSVP [65] which is bit 0 of VIEWMODE [71]. 2019-08-05 Reini Urban indxf: more table fields don't translate certain header strings to unicode: 0, 2, 9 Fixup test-data/2000/TS1.dxf to R2000, it was R2018. For now done manually in HEADER only. 2019-08-05 Reini Urban indxf: points indxf: search also in common fields add the common fields for obejcts and entities to the dynapi. search also point members (like dxf 20 for a 2DPOINT matching dxf 10 in the field) indxf: finish most tables, start with BLOCK_RECORD only a few fields are unknown, like 20, 30 for 3DPOINT 10, and the common object fields. indxf: add_eed Only for a very limited number of supported EED codes yet, and only for handle 1001 ACAD. indxf: add table.handle to table_control hdls vector allocate and special-case DIMSTYLE_CONTROL.morehandle[] allocate and set TABLE_CONTROL.hdls[] indxf: NEW_OBJECT and ADD_OBJECT macros examples: change handle types 2019-08-05 Reini Urban change handle types, add formatting macros handle.value is now BITCODE_BL (uint32_t) .code and .size are BITCODE_RC (uint8_t) Add FORMAT_H, ARGS_H(hdl) and FORMAT_REF, ARGS_REF(ref) macros for uniform handle output. Add indxf add_handle and add_handleref helpers 2019-08-05 Reini Urban dynapi: fix dwg_dynapi_entity_set_value for strings adjust dynapi line# indxf: more new_table indxf: more dxf_tables_read new_table and problems with certain *Active_CONTROL tables rename HEADER.LINETYPE_CONTROL_OBJECT to LTYPE_CONTROL_OBJECT and HEADER.DICTIONARY_NAMED_OBJECTS to DICTIONARY_NAMED_OBJECT for consistency, esp. needed by in_dxf indxf: start with dxf_tables_read indxf: fix dxf_classes_read indxf: fix empty strings dont scan past the \n indxf: handle unknown HEADER fields add 2 DXF-only TIME fields. most header fields can now be read. fix array_push need to return the changed hdls make Dxf_Pair, array_push, matches_type avail to in_dxfb dynapi: export all functions also the ones returning fields. optimize NULL type checks Replace AC_FUNC_STRTOD by AC_CHECK_FUNC AC_FUNC_STRTOD broken for cross-compiling add AC_FUNC_STRTOD probe indxf: postpone header_hdls, accept space in strings header_hdls is an array of fields and names, which needs to be filled after reading the tables with its handles. dxf_read_string failed to read strings with a space, like "Tavolo 3" indxf: improve logging indxf: fix the sscanf (%f) part advance dat (via strtod). Next: handles as string indxf: check types, handle points but the sscanf (%f) part is still wrong add dwg_dynapi_header_field, dwg_dynapi_common_*_field needed to do type-checking before setting a value. not in in the public API for now. indxf: dxf_header_read 2019-08-01 Reini Urban OLE2FRAME dynapi dxf values revive bd-unknown.inc destroyed before examples/bits: try all combinations avoid stack overflow, always try the next offset. 2019-08-01 Reini Urban add -x option to examples/bd|bits to easier decode hexdumps avoid stack overflow, don't restart with a smaller offset 2019-08-01 Reini Urban More OLE2FRAME found the MSD-CFB offset in the OLE2FRAME.data at 0x80 The header before are most likely the missing fields. 2019-08-01 Reini Urban Change OLE2FRAME remove flag 70, it is a fixed oleversion 70: always 2 mode is r2000+ DXF 72, tile_mode, 0: mspace, 1: pspace unknown is most likely the boolean lock_aspect, DXF 73 data is DXF type BINARY, 310 data_length is DXF 90 data embeds more fields, we do not decode yet: oleversion: always 2 (was flag) oleclient (e.g. "OLE" or "Paintbrush Picture") pt1 DXF 10, upper left corner pt2 DXF 11, lower right corner 2019-08-01 Reini Urban Fix types in 2 unit-tests Not detected by gcc, only clang-7 via -Wformat 2019-07-31 Reini Urban fix log out-of-tree fix logs-all.sh out-of-tree 2019-07-30 Reini Urban fixup dynapi.c generation when out-of-tree A fix for a51de973e5dca582536d425b28c82cc98165bbc1 r2007: rename internal unused sections_amount to num_sections r2007: more defenses 2019-07-29 Reini Urban fix out-of-tree make check-dwg and check-dxf, check-dwg-valgrind fix leak with Invalid System Section data_size fix gen-dynapi.pl out-of-tree when configured elsewhere WIP decompress_R2004_section: fix one more dst overflow. This time better Protect from illegal dwg->num _classes new error: dwg too small: n bytes decompress_R2004_section assert => error ERROR: decompress_R2004_section: src offset underflow many afl-fuzz cases Fix decompress_R2004_section overflow when writing to dst. Caught by afl-fuzz. Stabilize validate_POLYLINE when _obj->vertex[_obj->num_owned - 1]->obj is empty Add r2007 system section checks checking against a corrupt section map. Note that the size factor depends on the compression. we kill it when the compression would expand > 10x Fix unused page crash when we find a page.number < 0 (gap/unused page) initialize the next new page with NULL r2004 sections: clear on realloc otherwise we do have uninitialized chunk there renamed Dwg_Section_Info.pagecount to num_sections This was always very confusing. num-sections was not used and always 0, and pagecount was the number of pages/i.e. Dwg_Section **sections unit-testing: fix out-of-tree deps examples: fix out-of-tree deps afl: re-add more dwg_api functions so that the api examples can be built and fuzzed 2019-07-28 Reini Urban spec formatting Fix dwg_validate_POLYLINE without vertex[] Found via afl-fuzz Fix a R13 heap-buffer-overflow An off-by-one error, detected by afl-fuzz. Fix free dwg_class NULL deref Fixes part 14 of GH #126 Fix dwg2svg2 NULL deref Fixes part 13 of GH #126 Check Invalid Header section, skip when section[0] is invalid. Fixes part 9 and 11 of GH #126 Check Invalid AuxHeader: buffer overflow when section[5] is invalid harmonize logging of header.num_sections header.spec: formatting 2019-07-28 Reini Urban afl: disable most of the old dwg_api when compiling via afl-gcc/clang. with asan: make -j4 -s clean export ASAN_OPTIONS="abort_on_error=1:detect_leaks=0:symbolize=0:allocator_may_return_null=1" export AFL_CC="gcc" PERL=cperl5.30.0-nt \ CC="afl-gcc" \ CFLAGS="-m32 -O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -I/usr/local/include" \ ./configure --disable-static --disable-bindings --disable-dxf --disable-write $@ AFL_USE_ASAN=1 make -j4 -s -C src AFL_USE_ASAN=1 make -j4 -s -C programs dwgread LD_LIBRARY_PATH=`pwd`/src/.libs afl-fuzz -m none -i .fuzz-in -o .fuzz-out programs/.libs/dwgread @@ /dev/null without: make -j4 -s clean unset ASAN_OPTIONS unset AFL_CC PERL=cperl5.30.0-nt \ CC="afl-gcc" \ CFLAGS="-O2 -g -I/usr/local/include" \ ./configure --disable-shared --disable-bindings --disable-dxf --disable-write $@ make -j4 -s afl-fuzz -m none -i .fuzz-in -o .fuzz-out programs/dwgread @@ /dev/null 2019-07-28 Reini Urban Protect Invalid XRECORD.num_databytes Found via afl-fuzz 2019-07-28 Reini Urban Check obj->size overflow Throws ERROR: Invalid object size. Would overflow Fixes part 7 and 8 of GH #126, thanks to @strongcourage. A very hypothetical data corruption issue. Closes GH #126 2019-07-28 Reini Urban Fix heap-buffer-overflow in decompress_r2007 check offset underflow, pass thru error. Fixes part 5 and 6 of GH #126. Thanks to @strongcourage Fix heap-buffer-overflow in decompress_R2004_section check for dst overflow. Fixes part 4 of GH #126. Also check for invalid R134 num_sections. Thanks to @strongcourage protect bit_check_CRC from buffer overflow Fixes part 2 and 3 of GH #126 Thanks to @strongcourage Fix invalid free at decode.c:2289 part 1 of GH #126. We forgot to reset dat to abs_dat in one branch Thanks to @strongcourage dxf: fix some MTEXT dxf codes a followup to c6c36153ef3ea6fec406dfd53cd6ac8201485b5d 2019-07-27 Reini Urban use strEQ helper macros add strEQ helper macros regen-unknown: add new AEC objects to unknown But since AEC doesn't file to DXF, we have no known DXF objects/fields. They are parametric blocks, exploding to LINE, HATCH, ARC, TEXT, ... 2019-07-26 Reini Urban fix json test with new 2018 dwg MLINESTYLE.ltype [] was missing the final ] fix MTEXT for r2018 almost. The column_heights vector is still missing. new example_2018.dwg, TS1.dxf The old dwg was an old version add GEOMAPIMAGE as debugging class but no coverage fix out-of-tree gen-dynapi.pl gen-dynapi.pl is in srcdir fix unit-testing coverage 2000/PolyLine2D.dwg was missing from DIST. fix out-of-tree builds for one and two levels down, ../configure or ../../configure Update NEWS, TODO Added a lot of coverage and really found some bugs. xrecord: skip xdata test xdata is still a linked list, not an array ole2frame: data != dat_length mismatch TODO add 2000/TS1.dwg by Guruprasad Rane, 2011 (GPL3) needed for more unit-testing coverage unit-testing: improve api_common_entity dont print the common values, only the handles. speeds it up unit-testing: add api_common_object check more common handles LWPOLYLINE needs to be checked by name because it might be a class (535), when being backported to R14. Fixes lwpoline unit-test for r14. unit-testing: allow NULL handles and switch the logic, fail first. many layers r2004+ are empty. fix unit-tests found with new coverage add dynapi coverage, fix dwg_dynapi_common_value detected by adding tests for it. 2019-07-25 Reini Urban Update NEWS TODO Merge branch 'gh124-dejagnu' See GH #124 Now only the unit-testing coverage needs to be improved. rm test/testcases Closes GH #124 fix dynapi_test for char** encr_sat_data There is no num_encr_sat_data unit-testing: allow NULL strings unit-testing: fix VERTEX_(MESH|PFACE), 3DSOLID VERTEX_(MESH|PFACE) missed the VERTEX_3D typedef. 3dsolid may fail before, and thus have a NULL history_id. Also ensure that unknown_2007 and history_id are only for version 2 unit-testing: finish the rest unit-testing: fix a few text errors and add more checks unit-testing: dimension 2019-07-24 Reini Urban unit-testing: polyline windows: fix warning: "alloca" redefined unit-testing: enhance coverage add pass,fail,ok to unit-testing check coverage, enhance coverage by checking more dwg's, remove INPUT from TESTS_ENVIRONMENT, don't exit immediately, collect errors, return error_code at the end. more double linkage on windows with dynapi and get rid of the -lm dependency avoid double linkage on windows with unit-testing 2 bits functions are exported, which clashes on windows. disable the EXPORT attribute there when linked locally. change bits_test.cbmc target use macros 2019-07-23 Reini Urban disable lsan for unit-testing just too much work for now to clean up all the copies add ATTRIBUTE_MALLOC, probe for FUNC_ATTRIBUTE_FORMAT more scan-build warnings Potential leak of memory decomp Dead assignment uninitialized value add test/unit-testing/dynapi_test.c dont rely in Convert::Binary::C Improve dwg_dynapi_handle_name Dont convert obj to _obj to obj back & forth dwg_dynapi_handle_name return UTF-8 strings when the field is a wide-string. All the tables use FIELD_T names. But the dynapi sometimes misrepresents T types as TV, so only check against TF, which is always single-byte. add dwg_dynapi_handle_name similar to dwg_obj_table_get_name, which only supports tables. This supports all objects and entities with a name field. fix xline dynapi caught with the new unit-tests export dwg.c functions in the body also. just to seperate it more clearly from static 2019-07-23 Reini Urban more unit-testing entities make -C test/unit-testing check \ TESTS_ENVIRONMENT='INPUT=../../td/example_2004.dwg' ... for most dwg's 2019-07-23 Reini Urban enhance unit-testing iterator catch also ATTRIB and ATTDEF entities. Check more NULL refs disable dejagnu See GH #124 2019-07-22 Reini Urban dynapi_test: simplify pass () move some testcases to unit-testing fix some string tests with valid NULL strings. get rid of dejagnu there, i.e. roll our own (better one) WIP: unit-testing dynapi we need to get rid of the old dejagnu testcases, get rid of the unit-testing print-only check: compare to low-level values, test the new APIs: by object and by type. strdup: set the feature at first need __STDC_WANT_LIB_EXT2__ set before including any feature.h on older glibc's, which do need _USE_BSD instead. 2019-07-21 Reini Urban unknown: remove 1 DIMASSOC with invalid handle WIP GEOMAPIMAGE fields And some more docs Update NEWS for the new API functions 2019-07-20 Reini Urban more GCC30_DIAG fixups They are ignored for newer gccs. Use the new decl. also decode_r2007: pages_map memory leak on error dynapi: null pointer dereference [-Wnull-dereference] decode: null pointer dereference [-Wnull-dereference] encode: declare strdup warning: incompatible implicit declaration of built-in function ‘strdup’ 2019-07-20 Reini Urban api: Allocator sizeof operand mismatch eg wrong string handling: dwg_ent_set_UTF8 Result of 'calloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'char *' make -s scan-build SCAN_BUILD=scan-build-7 2019-07-20 Reini Urban dwg_api: potential null pointer dereference [-Wnull-dereference] 2019-07-19 Reini Urban Fix warning: declaration of ‘index’ shadows a global declaration i.e. the index function. only with older compilers. Fix GCC30_DIAG_IGNORE (-Wformat-nonliteral) for older gcc <4.6 only allowed outside functions until gcc 4.6 (or clang). Before gcc-4.6 the pragma needs to be before the function in question. .c.ii without cc extensions -MT -MD -MP -MF pgcc struggles with it 2019-07-19 Reini Urban revamp CC_DIAG_IGNORE remove unused defines, simplify. Note that clang -Wtautological-constant-out-of-range-compare in 3 places cannot be suppressed, but we'll get rid of these old overflow checks soon, as we do better now. 2019-07-19 Reini Urban gcc -Wformat-nonliteral is since 3.0.4 at least and in clang also 2019-07-18 Reini Urban Merge branch 'gh97-dynapi' Closes GH #97, but there are no test-cases for the new API yet. dwg2svg2: use the new partially typed API missing dynapi utf8text functions (2) the simplified dwg_{g,s}et_OBJECT_utf8text() API add the missing dynapi functions, add is_utf8 to setters update NEWS for 9.0 add dwg_dynapi_entity_utf8text which returns a fresh copy of a TU string converted to UTF-8, as with the deprecated API. 2019-07-17 Reini Urban dynapi: replace deprecated API functions WIP See GH #97 api: move Dwg_Version_Type to dwg.h make dwg->header.version a public enum, not some strange unrelated int. This also adds documentation to R_* release <> AC* DWG versions. minor dwg.spec simplification fix a suffix() edgecase, when basename() fails darwin fprintf dtoa leak and more darwin leaks. not detected via lsan, only via valgrind. convert dxf VALUE_RD to a function, too large for a macro. maybe add a 0-stripper here later. dxf: non-destructive FIELD_BD for angles, dont change the field value. convert only the printed value on-the-fly rad2deg fix logs_all.sh to use parallel version 2019-07-17 Reini Urban unknown: disallow TV in r2007+ versions cannot try TV fallback in TU dwgs. also stabilize PICAT and PARALLEL version probes a bit (space in pathname). The logs-all.sh target is still wrong though, fixed in next commit. 2019-07-16 Reini Urban unknown: add is_entity flag check ENC or CMC based on it (see GH #123) fix bd-unknown.pl to be run from examples via make. add some new unknown: skip some overlarge ACAD_TABLE objects leading to picat out-of-memory errors fix -Wnull-dereference warnings potential null dereferences, detected by -flto -O3 regen-unknown with fixed hdlsize some objects Hdlsize: were missing unknown: add hdlsize which is needed to find the last handle, to seperate it from the final padding until the crc. unknown: rename bitsize => num_bits use bitsize only for the matching obj->bitsize and num_bits for the calculated unknown->num_bits unknown: comment sizes and add [RL] to the read bitsize (opposite to a calculated value) bit_read_ENC: we do have hdl_dat now fix unknown bit_ENC for 2+ streams run make regen-unknown: with more unknown pairs got a couple of more dwg/dxf pairs, with new objects fix regen-unknown with the changed log format for bitsize. also get a few new files add generated json.test to .gitignore 2019-07-15 Reini Urban bump copyright year to 2019 to all in 2019 changed files stabilize autogen.sh See GH #101 move -version-info upwards add -version-info for the shared lib was only 0:0:0, now 0:8:0 fix -Wrestrict in dwg_decode_##token##_private warned only by gcc, not clang fix ax_python_devel.m4 wrong -z check 2019-07-15 Reini Urban add .c.ic rule, probe for $(CLANG_FORMAT) make -C src decode.ic will create an expanded version of decode.c in-place, keep a proper backup! used to find problems in macros. clang-7 started omitting the .0 2019-07-15 Reini Urban silence -Wformat-nonliteral Closes GH #121 2019-07-15 Reini Urban expand [rcount1], [rcount2] to [%d] for LOG_TRACE better logging. It looks expensive, timings: without with make check 0m12.034s 0m12.303s (mostly -v2) ./logs-all.sh 0m35.934s 0m37.324s (only -v4) so it's neglectable. TODO -Wno-format-nonliteral 2019-07-15 Reini Urban Merge branch 'gh85-limitall' into smoke/master Closes #85 2019-07-14 Reini Urban unrestrict dat before the CRC calculation and fix it for the restricted range. The CRC exceeds it, do it absolutely. We unfortunately start our dat after the obj->size, not before, at obj->adress. unknown_bits: permit overflow of one byte temporary. the new restricted streams found this overflow 2019-07-14 Reini Urban seperate and restrict the 3 streams to catch overflows, put them on the stack. See #85 This enables now interleaving of handles in the spec, need not to be at the very end. restrict dat at dwg_decode_add_object(), keep the 3 streams at the same initial offset, the obj->address - obj->size, and also its size, and tighten it later as of now (in decode private). Previously the hdl_dat 0 and str_dat 0 were at their resp. starts, but this way we can compare them easier. Calculating the relative stream positions is now trivial, e.g. for the padding check in DWG_ENTITY_END. add helper function obj_stream_position() which returns the furthest handle position (data, handle, string streams) set dat position to the max(dat, hdl_dat, str_dat) for the padding and crc check. harmonize pos and address name suffices pos for bit positions, address for absolute byte addresses (objects only) There's no need for the offset fields dat_address, hdlpos, strpos, only bitsize_pos is needed for encode, to patch-in the bitsize. Remove unneeded obj->handle_offset (== obj->bitsize) and obj->string_offset. XRECORD: fixup objid_handles[] hdl_dat loop 2019-07-14 Reini Urban fixup crc logging fixup logging indentation any read value needs to be logged at col 1, and calculated value indented. change FIELD_HANDLE @pos logging to INSANE (v5) protect NULL ptrs in get_next_owned_entity by dwg2dxf example_2007 add bits dat->opts for loglevel this way we can silence known overflows, and honor the given loglevel 2019-07-13 Reini Urban bits: log overflow errors log hdl @pos for each handle 2019-07-12 Reini Urban Merge branch 'smoke/asan' Fixed all leaks travis: re-enable full lsan/asan checks fix dwg_ent_get_ltype_name doc fix unittest leaks fix dwg2svg2 leaks a bit more tricky, because dwg_api does not contain the R_2007 enum dwg2dxf: fix invalid free fix dwggrep leak with pcre2_16 fix geojson leaks travis: re-check without lsan lsan fixes: detect asan and call dwg_free then Never skip dwg_free when compiled with asan, even if lsan is disabled. (i.e. by default under darwin) We don't check for getenv(ASAN_OPTIONS) =~ detect_leaks=1 add dsymutil to log on darwin Note: this really should be added to COMPILE somewhen. fix 3dsolid leaks with version 1 also free the last empty block, with version 2 calloc 3 blocks, with size 0 for the last. travis: use xenial for pcre2/dwggrep tests travis: add asan 2019-07-11 Reini Urban protect invalid free 2019-07-09 Reini Urban dxf: protect empty last_attrib fixup wrong clang-formatting 2019-07-08 Reini Urban fixup --enable-debug json nan values for json.test. With debug many numeric values are nan. use the probed paths for sed and jq. See #108, but we don't want to intercept fprintf %f for nan. An error is an error. 2019-07-08 Reini Urban remove xrecord,proxy get_ownerhandle API 2019-07-07 Reini Urban remove unneeded ownerhandle and update the dynapi Move ownerhandle to parent Object_Object along reactors and xdicobjhandle. This field is common to all objects. See #118 fix print FIELD_ENC for color.handle change For the change in 84bdc444fc5262c4 2019-07-07 Reini Urban START_OBJECT_HANDLE_STREAM #118 Generalize object handles: Rename common field ownerhandle, exp. not NAME_control 330. Remove various null_handle fields. Rename LTYPE.null_handle to LTYPE.extref_handle Add SORTENTSTABLE.dict_handle (previous called ownerhandle, it IS the ownerhandle. ok, there we do have both, the parenthandle and the ownerhandle) 2019-07-07 Reini Urban Add more missing ownerhandle fields But that really should be in Dwg_Object_Object instead. See #118 2019-07-07 Reini Urban Fix FIELDLIST standard handles See #118, thanks to normwill-beast. This will be simplified to a generic handle stream reader, outside the dwg.spec, only carrying object-specific fields there. With the handles intermixed, not necessarily at the end. 2019-07-07 Reini Urban Fix FIELD.childs and objects And add ownerhandle and the other missing standard handles. Closes #117, thanks to normwill-beast Fix MLINESTYLE.ltype handles Read them from the handlestream, after all others. Closes #116, thanks to normwill-beast. 2019-07-07 Reini Urban Fix MULTILEADER content_block And fix invalid free of ctx.content.txt.style. Only set ctx.content.blk.block_table with ctx.has_content_block, and move it down to the handle stream (will be fixed up later, with a proper hdl_dat) Fixes e.g. ERROR: Invalid 3BD ctx.content.blk.{scale,normal}, because we have no hdl_dat setup yet. Closes #113, thanks to normwill-beast 2019-07-07 Reini Urban Add many missing handles 2007+ Due to the fixed handle_stream offset, we can now reliably read many more handles. DIMENSION_ORDINATE DIMENSION_LINEAR DIMENSION_ALIGNED DIMENSION_ANG3PT DIMENSION_ANG2LN DIMENSION_RADIUS DIMENSION_DIAMETER MTEXT BLOCK_CONTROL STYLE SORTENTSTABLE Closes GH #115, thanks to normwill-beast. Renamed STYLE.null_handle to STYLE.extref_handle. Kept SORTENTSTABLE.owner_dict name, documented as SORTENTSTABLE.parenthandle. owner_dict sounds more specific and less general, but we have no other parenthandle fields. 2019-07-07 Reini Urban Missing START_HANDLE_STREAM in APPID, DICTIONARYVAR, VPORT_ENTITY_HEADER. Fixes many missing APPID.app_control and DICTIONARYVAR.ownerhandle. and Invalid handleref: warnings. Closes GH #114, thanks to normwill-beast 2019-07-07 Reini Urban Incorrect object address #112 handlestream_size is not part of obj->size. This fixes the hdlpos += 8 FIXME and many Invalid handleref and Invalid handle pointer code errors. Also many ownerhandle, and other handle offsets. Thanks to normwill-beast 2019-07-06 Reini Urban clang-format 2019-07-06 Reini Urban defer color.handle to handle_stream for >= R_2007 we dont know the handle stream yet, when reading the common_entity_data. Defer to the start of the common_entity_handle_data reading the common color.handle then. Fixes #111, Thanks to normwill-beast. And while we are there sanitize the common entity color.handle: No extra color_handle needed. Make the handle a real H (ie. ref* to the DBCOLOR object). Remove the obsolete dwg_ent_get_color_handle API. Extend bit_{read,write}_ENC to include all 3 streams, but it is still not used yet. 2019-07-06 Reini Urban fix EED code 5 as int64 Incorrect reading of the spec, fixes many MTEXT entities. Fixes GH #110. Thanks to normwill-beast 2019-06-26 Reini Urban dwg_ref_get_object: error on !ref->obj the caller has to resolve it, we have no dwg here fix NULL in out_geojson Thanks to @UmlauteUeberall Closes #107 2019-06-25 Reini Urban Release 0.8 See NEWS 2019-04-26 Reini Urban redo build-aux/clang-format-all.sh src test examples programs bump copyright years to 2019 dwgbmp: skip free unless on valgrind and add some missing free calls. test: make check-valgrind -C programs/ bin_PROGRAMS=dwgbmp preR13: initialize more missing TABLE obj fields fixing various valgrind errors, esp. with dwg_obj_is_control() Partially clang-format include *.h Not the typedef's and struct's, as gen-dynapi.pl cannot yet parse the changes properly. See the work/clang-format-inc branch. preR13: fix wrong FIELD_TF check preR13 we have no obj->address and obj->size, leading all VECTOR_CHKCOUNT to fail. skip that for now. only detected with valgrind 2019-04-25 Reini Urban EED: fix invalid free on failing EED on final free with 2007/Leader.dwg. This fails early with No EED[9].handle Also fix a double-free when failing dwg_decode_eed_data. 2019-04-25 Reini Urban clang-format-all fix read_R2004_section_info heap overflow on a page gap (info->pagecount++), we need to realloc the sections, or info->sections[j] might overflow. 2019-04-24 Reini Urban smoke.sh: debian testing broke a few clangs clang 3.8, 3.9 and 4.0 are now broken get_last_owned_block: fix -Wnull-dereference EED: no free with handle errors fixes asan errors with #99 cases 2019-04-23 Reini Urban EED: add more eed_need_size checks Check also individual dwg_decode_eed_data decoded sizes, to abort not enough room for wrong codes. Fixes #104. EED: detect invalid objects earlier STYLE: protect from empty font_name May be a NULL ptr. Fixes case bit_convert_TU@bits.c:1323-3___null-pointer-dereference of #99. dxf: simplify dxf type 5 vs 105 for DIMSTYLE only one write, not two dxf: check object types which is a more general fix for wrong object, as in #99 case dwg_dxf_LTYPE@dwg.spec:2523-11___heap-buffer-overflow dxf: protect invalid LTYPE_BYBLOCK check LTYPE header reference for the correct type. Fixes case dwg_dxf_LTYPE@dwg.spec:2523-11___heap-buffer-overflow at #99 dwg_block_control: add error handling fuzzing created an invalid DWG without initial BLOCK_CONTROL object. Check this and error. Fixes case dwg_dxf_BLOCK_CONTROL@dwg.spec:2154-1___out-of-bounds-read of #99 2019-04-22 Reini Urban continue with COMMON_ENTITY_HANDLE_DATA if possible, and the entity-specific decoding had an VECTOR_CHKCOUNT_LV error. This is only possible with r2007+ entities validate _hdr->endblk_entity in get_last_owned_block and add if missing. This fixes the problem of the previous commit much better, it is not only a DXF-specific hack anymore. Closes part 2 of #99, the bit_read_B@___out-of-bounds-read testcase. Unlike as with the previous fix, the generated/found ENDBLK entity has now the correct groups 5 and 330, and the missing object_ref handle is fixed up. 2019-04-21 Reini Urban dxf: WIP fix for empty ENDBLK entity This from the #99 bit_read_B@___out-of-bounds-read fuzzer case. TODO: The real fix should be put into dwg_validate_INSERT so that get_last_owned_block can never fail, and always return a valid ENDBLK even if it couldn't be found at decode. 2019-04-20 Reini Urban fix #99 first SEGV dwg_dxf_LEADER@dwg.spec:2034-3___null-pointer-dereference This is at FIELD_3DPOINT_VECTOR in LEADER. There are illegal size fields (num_points) in LEADER on decode, which are not yet set to 0. Add a _LV macro variant for size lvalue, which can be set to 0. Also found an entity with entmode 3 but empty ownerhandle. Write an empty ownerhandle then. Fixed also a typo in writing the mspace block_record with entmode 2: PSPACE => MSPACE 2019-04-20 Reini Urban dwg_decode_eed_data: whitespace only 2019-04-19 Reini Urban run bash clang-format-all.sh src programs examples test excluding include bindings, with clang-format-mp-devel. with an older clang-format than devel (i.e. 8.0) you can also just run it with the -style=GNU option, but I changed three options: SortIncludes:false, SortUsingDeclarations: false, IndentPPDirectives: AfterHash 2019-04-19 Reini Urban fixup includes and generators a bit avoid EXPORT redef after clang-format-all. also improve the generated C sources to match the formatting more. add .clang-format created with the undocumented GNU style: clang-format -style=GNU -dump-config > .clang-format 2019-04-07 Reini Urban cirrus: add branch filter 2019-03-30 Reini Urban --disable-python on cygwin it's just too broken to be repairable for now. python3.6m works on x64 though. --enable-python=yes vs check/default only die with yes, disable if not found instead 2019-03-29 Reini Urban appveyor: cygwin defaulted to python3 now /usr/bin/python3 is now the default, but there's still an old /usr/bin/python around. it couldn't be linked, because python36-devel was missing. 2019-03-29 Reini Urban config.h: silence __XSI_VISIBLE redefined warnings guard __XSI_VISIBLE redefinition, only needed for cygwin strdup. add config.h.in to git, autoheader does not overwrite it. 2019-03-29 Reini Urban patch ax_python_devel.m4 for cygwin keep using ac_python_library (esp. for the m suffix) patch ax_python_devel.m4 for --enable-framework and LOCALMODLIBS. Reapply our old patches revert ax_python_devel.m4 to upstream skip our python probe improvements, they caught up in between windows: fix type warnings -Wincompatible-pointer-type, -Wunused-function add AX_ADD_FORTIFY_SOURCE probe for faster glibc calls, and some compile-time safety fix 2 -Wmaybe-uninitialized vars api: add some missing deprecation decls dwg_api.h is not included into swig at all. fix gcc-4.4 -ansi errors duplicate typedefs shadowed index variable decl color.index: signed short may be negavtive. Only cygwin gcc emitted this -Wtype-limits warning 2019-03-22 luz.paz Misc. typos Found via `codespell` 2019-03-01 Reini Urban myalloca.h: fixup wrong #if HAVE_ALLOCA_H need #ifdef 2019-02-25 Reini Urban add section_infohdr struct its num_desc replaces num_info Fix gen-dynapi.pl for FreeBSD 12 2019-02-25 Reini Urban Fix clang support for gen-dynapi.pl (#98) Add all the -print-search-dirs, not just the first. For clang /usr/lib/gcc/x86_64-linux-gnu/8 is needed also. Stabilize clang detection by checking for the include dirs, not the executable name (which is cc on FreeBSD e.g.) Also remove BITCODE_BS defines clashing with the typedef, leading to typedef uint16_t uint16_t; This also fixes many wrong dynapi types to proper BITCODE_BS. Closes #98 2019-02-25 Reini Urban WIP clang support for gen-dynapi.pl (#98) Some more defines still needed 2019-02-24 Reini Urban section: add more tracing section: add one more invalid Section info check The addresses must raise. Reformat logging a bit 2019-02-22 Reini Urban fix some compiler warnings and wrong types, esp. encr_sat_data TV => char** section: cosmetics r2007 calls the SECTION.number id. We call it number because of R11 2019-02-21 Reini Urban geojson: encode color as rgb (r2004+) or index Closes #95 json: field_cmc use Dwg_Color* by ref don't copy the struct. for consistency json: color names are only TV no unicode json: abstract field_cmc() function no macros needed. makes for much smaler code and easier debugging. the color struct is passed by copy for now. json: print only alpha color names many names are still garbled, like VIEWSTYLE.edge_obscured_color don't print them if they don't start with an alpha character. json: enhance color map skip defaults, index default is 0, add flag, name and bookname geojson: better Layer, use name or Text properties Skip empty Text, use name for INSERT 2019-02-20 Reini Urban geojson: skip default Linetype print color as number geojson: skip null properties geojson: add color property but not the color name, just the index. Google Maps expects a name, e.g. blue log: accept td/*.dwg symlinks 2019-02-20 Reini Urban fix LAYER.on flag (#96) set it for r13-r14, and fix the flag field also (no color_rs there). fix it for r2000+ (reverse). use it in dwglayers 2019-02-20 Reini Urban regen unknown: depend on bd-unknown.inc add bd-unknown.inc generation rule decode: advance chain ptr for picture (unused) just for consistency. the ptr is set absolutely in the next lines for the header. replace memcpy with bfr_read api: rename section.unknown2 to unknown harmonize 2007 section types with 2004 sizes and addresses are unsigned. re-use bfr_read with 2004 harmonize Dwg_Section_Info, memcpy struct similar to 2007 bfr_read() rename start_offset to offset, use RLd section.number (i.e. int32_t) 2019-02-20 Reini Urban Improve/harmonize logging 2004 section sizes (#93) read_R2004_section_info still has a problem with wrong page sizes, the 2007 variant read_data_section not. Continue on fc3fd1c14eb08f6e06f516753bfac1fa59029d3a The section_size is uint64, not int32. (ODA p28) $ programs/dwgread test/test-big/2004/HARTA_E_PRISHTINES.dwg ERROR: read_R2004_section_info out of range Warning: Failed to find section_info[13] with type 0x3 ERROR: Failed to read compressed class section 2019-02-20 Reini Urban json: share cquote with geojson add myalloca.h and freea(ptr) for all the various alloca usages. freea() is a noop, only used on old systems without alloca (where malloc is used instead). 2019-02-19 Reini Urban use AC_FUNC_ALLOCA probe and use the recommended prologue, assuming it exists everywhere (C99) 2019-02-19 Reini Urban more GeoJSON support (#95) TEXT, MTEXT: Text feature and insertion point proper Layer and Linetype names add dwg_ent_get_ltype_name API 2019-02-19 Reini Urban geojson: fix undefined behaviour with loop counter dwg_geojson_LWPOLYLINE: don't use the counter after the loop. fails with ubsan 2019-02-14 Reini Urban more gen-dynapi.pl fixups: bsd define more new libc-specific macros, for darwin. BL is now fixed up again. fixup gen-dynapi.pl for cc-specific stddef.h and unify uint16_t to BS, uint32_t to BL, needed since fcfbe04fd338627e7713c48ddd51cbdc5384dd6c (typedefs) GeoJSON: fix json commas passes now jq add geojson jq tests to json.test GeoJSON: LWPOLYLINE also as direct type seperate it into its own function to handle it directly or as variable type 2019-02-07 Reini Urban skip attribute_deprecated_with_message with icc The msg arg is not supported with icc 12 ax_compiler_flags_cflags: set ac_c_werror_flag=yes This ensures compilers like icc read the actual stderr conftest.err when -Werror=unknown-warning-option is invalid. more restrict 2019-02-06 Reini Urban dwg.h: fixup RLL confusion 2019-02-06 Reini Urban api: change BITCODE defines to typedefs This pins down the types, and helps in debugging and the dynapi. eg fieldhandles is now a H* BITCODE's were added with 19ccf73769024991c43e08c012db010790ffd9dc to d28470bcaa61d0ce811aeb8ba8aa77ff6a010f1d 2019-02-06 Reini Urban cygwin32: fix include/dwg.h types The cygwin probes fail to check HAVE_STDINT_H, and these config.h defines are not available in the public header anyway. Need to fallback on defines for a pure non-autotooled system. on 32bit without HAVE_STDINT_H the sizes are different. Should fix the dynapi HEADER tests. 2019-02-06 Reini Urban demand C99 stdint.h we already demand that via AC_PROG_CC_C99 assume in dwg.h stdint.h and inttypes.h, without demanding autotools HAVE_STDINT_H defines e.g. freebsd insert.c:21:56: warning: format specifies type 'unsigned int' but the argument has type 'BITCODE_BL' (aka 'unsigned long') [-Wformat] printf ("object count for insert : " FORMAT_BL "\n", insert->num_owned); 2019-02-05 Reini Urban dwgread: no extra \n dxf: add object_entity dxfgroups to dynapi and fixup some wrong/missing groups dxf.test: honor --enable-debug setting works now with and without --enable-debug dxf: honor --enable-debug to test out_dxf and DXFIN with unstable objects configure: document --enable-debug as unstable it should have really been called --enable-unstable, but there we are. it also disables -O2 and sets -fno-omit-frame-pointer, which makes for easier debugging. 2019-02-04 Reini Urban dxf: fix ACTION => "dxf" expansion in classes.inc fixes detection of UNSTABLE_CLASS in dxf ACTION, and force setting of name, dxfname and fixedtype for all varying classes with decode and all importers override the dxf.test for UNSTABLE_CLASS to expect only the CLASS entry, no object entries. 2019-02-03 Reini Urban dxf: disable ACTION dxf with UNSTABLE_CLASS as acad import might crash with them. WIP ACTION needs to be passed 2x as arg to be expanded. The other ACTION check is also not working. dxf: VISUALSTYLE restrict 290, 291 to FIELD_B (not BS) They are most likely wrong, and fail to import if not 0/1 skip dxf_validate_DICTIONARY NULL all invalid handles in out_dxf dxf_validate_DICTIONARY skip invalid ownerhandles dxf-roundtrip: fixup outname with e.g. example_2000 not being example_2000_2000.dxf 2019-02-02 Reini Urban add Dwg_Entity_ARC_DIMENSION with --enable-debug yet untested dynapi: add dxfgroups (#92) WIP also add new RENDERENVIRONMENT, RENDERGLOBAL objects (untested, but documented as DXF) 2019-02-01 Reini Urban mark endian specific code The lib only works on LE (little-endian) so far, for BE we would need to abstract some section code to bits_*LE read_R2004_section_info: remove unused Oops The rootcause is now fixed, Closes #93 2019-01-31 Reini Urban read_R2004_section_info (#93) num_sections => pagecount use uin64_t section_size, not int32. remove the wrong num_sections field, which is documented as PageCount. decode: signed read_R2004_section_info section_number (#93) a negative number denotes a gap/unused section decode: harmonize r2007 section logging mostly whitespace, one wrong 0x6 in the offset 2019-01-31 Reini Urban ATTDEF: fix r2007+ STRING_STREAM also for ATTRIB, now we get the right style handle and for ATTDEF the right prompt. {START,END}_STRING_STREAM now only used within header_variables.spec 2019-01-31 Reini Urban ATTDEF: add missing ATTRIB fields it is defined as ATTRIB plus some 2 more fields fix dxf-allcvt.sh skip not existing globbed files dxf: re-order ATTDEF 3 prompt needs to be before 2 tag. But the prompt is not read properly, TODO 2019-01-30 Reini Urban Merge branch 'smoke/dynapi' 2019-01-29 Reini Urban dynapi_test: special-case strcmp which interestingly only failed on 32bit api: not deprecated dwg_obj_layer_get_name analog to the other tables dynapi_test: include config before public api even freebsd-amd64 started failing suppress -Wdeprecated-declarations on gcc and clang for the unit-tests and testcases dynapi_test: disable broken cygwin32 header test There the dynapi works fine, but the dwg->header_vars.VAR reference is broken somehow (some wrong offset?). api: add type getters and setters WIP 2019-01-28 Reini Urban api: add dwg_get_HEADER, dwg_set_HEADER by name doc: fixup refman doxygen: expand macros to generate decls for docs, add deprecations dynapi: fix EXPORT of internal syms need to generate imp_dwg_dynapi_* functions in .dll.a for windows dynapi: add dwg_get_OBJECT (#59) all entites and objects, also all missing typedefs. The api should be now complete, sans the common fields dynapi: add dwg_get_ENTITY (#59) objects not yet api: remove wrong nonnull attribs we need to allow API NULL args, which we cannot control dynapi: add dwg_dynapi_common_value and its structs, sorted by name. check more dynapi args for NULL api: revert dwg_ent_region_get_acis_empty we need to pass through the api. failed on FreeBSD bump copyright years, fixup #lines harmonize REPEAT Invalid rcount errors print the dxfname and fieldname similar to REPEAT_CHKCOUNT dynapi_test: skip count for objid_object_handles PROXY.objid_object_handles has a computed count (TODO) dynapi_test: skip count for VECTOR_N _transform or _transmatrix fields are malloced, but have no countfield. they have a fixed size of 12 or 16 rename LEADER.numpts to num_points for consistency with the points* field, and a consistent num_ prefix api: rename TABLE.attribs to attrib_handles for consistency with all other attrib_handles dynapi_test: skip more fields without a count 2019-01-28 Reini Urban api: rename LTYPE.dash, XRECORD.num_eed LTYPE.dash => LTYPE.dashes XRECORD.num_eed => RECORD.num_xdata. Found those api errors only with dynapi_test 2019-01-28 Reini Urban dynapi_test: special-case num_reactors count dwg_api.h: finish deprecations and nonnull decls doc: improve refman target dynapi: fixup some H* fields Convert::Binary::C cannot seperate H* from H, both are just Dwg_Object_Ref* So we need to parse the defines. Fixes the COMMON_TABLE_CONTROL_FIELDS H* fields, and COMMON_ENTITY_POLYLINE vertex H* dynapi: check countfields of arrays. copy strings, do the malloc in the API. dynapi: extend need_malloc to indirect+malloc+string fixed-size structs like H, TIMEBLL, CMC don't need malloc, only dynamic arrays like TV, H*. add a seperate indirect field for structs ($is_ptr), and if it's a null-terminated string (ascii or wide). These are needed for the memcpy/strcpy in the getter/setter. dynapi_test: undo var++ fixes invalid free when incr num_textfield dynapi: add obj->name field not the dxfname, but almost: DICTIONARYDFLT and PLACEHOLDER are e.g. different dynapi: more type cleanup resolve more BITCODE types, esp ptrs. add need_malloc field, and reserve dxf field. 2019-01-28 Reini Urban dwg_api: more refactoring WIP add nonnull compile-time checks, add deprecation messages. because of the static loglevel we cannot inline the api functions with LOG_ERROR 2019-01-28 Reini Urban dynapi: refactor dwg_api WIP add error handling and logging to dynapi. rename dwg_get_OBJECT to dwg_getall_OBJECT check entity type for dwg_dynapi_entity_*value() dynapi: add setter API (and tests) silence dejagnu warnings on clang e.g. freebsd. dejagnu.h is long unmaintained dynapi: fixup name[4] to types is ptr then, and skip the suffix dynapi: workaround missing stddef.h on cygwin32 stddef.h is missing. provide an offsetof workaround. the other possibility would have been to provide static offsets for 64bit and 32bit machines, but there are other ABIs, such as x32 (ptrsize 4, intsize 8). dynapi: skip gen-dynapi for testcases dynapi: fixup sorting of dwg_name_types for _3D 3DFACE and 3DSOLID are now proper names to be searched for dynapi: fixup more types 2019-01-28 Reini Urban dynapi_test: add HEADER tests sort the header_variables_fields by name, not offset still failing: 3DFACE, 3DSOLID 2019-01-28 Reini Urban dynapi: fix name* to type* fixes compilation of dynapi_test. Now just the HEADER dynapi is failing 2019-01-28 Reini Urban dynapi: more dynapi_test objects WIP add all the entities, objects and fields. change MULTILEADER from object to struct _dwg_entity_MULTILEADER for internal consistency with the dynapi. 2019-01-28 Reini Urban add testcases/dynapi_test WIP generated from all fields dynapi: move to public dwg_api.h allow NULL Dwg_DYNAPI_field *fp, rarely needed to get the type, size or offset dynapi: test it, refactor a bit dynapi: regen dynapi: rename TABLE.entry_name field to name dynapi: add generic getters, NULL terminate the fields and add size to Dwg_DYNAPI_field for easier memcpy without the need to lookup the BITCODE_ type. dynapi: add api functions make dwg_entity_names and dwg_object_names bsearchable (equal size) dynapi: add _fields access to dwg_name_types[] We need to bsearch the OBJECT to get to the _dwg_OBJECT_fields. dynapi: unexpand BITCODE_* macros TODO: DIMENSION_COMMON, _3DSOLID_FIELDS macros union _dwg_MLEADER_Content_u dynapi: add dynapi.h with OFF macro use builtin offsetof(struct,field) and only the default value if stddef.h is not found 2019-01-28 Reini Urban Add gen-dynapi.pl, dynapi.c WIP Generate dwg.h struct names and field types, offsets. TODO: types not as string? link _fields[] to some name array, either dwg_name_types or dwg_entity_names See #59 2019-01-28 Reini Urban dxf: print BL LAYER_INDEX.timestamp1 as float out_dxf overflows BL/%u in snprintf dxf-allcvt: fix test-big fix r2007 XRECORD strings 2019-01-27 Reini Urban dxf-roundtrip.sh: support td/example_20*.dwg fix HATCH_gradientfill logic wrong cond dxf: use a better CMC index for a given rgb value. The index is still wrong, (e.g. 194 instead of 250 for rgb 0xcccccc) but helps importing the DXF. The index is mandatory, even for truecolor. dxf: mandatory LAYER.flag 70 may not be left out, even if value 64 doc: better links rename type EMC to ENC (entity color) and change some VISUALSTYLE colors from CMC to ENC 2019-01-25 Reini Urban configure: skip bindings/python without swig dxf: print subclass markers since r13 (#90) not just since r2000. Fixes dxf-roundtrip for the #90 example. Thanks to @Febfire for the example dwg to find the problem dxf: DIMSAV is not in r14 2019-01-17 Reini Urban configure: improve PERL_VERSION unused, just for printing 2019-01-16 Reini Urban dxf-allcvt: add test-big added to stable: UNDERLAY entities, UNDERLAYDEFINITION, CAMERA regen-unknown without test-big dwgs logs-all: add test/test-big seperate huge DWGs/logs from the normal test-data. there exists no logs-all.sh.in.only the parallel and serial variants (parallel ignored) improve HATCH_gradientfill: type CMC and the double is the shift_value: 0.0 or 1.0. also fixes the wrong ODA docs for Repeats # of Gradient Colors cirrus freebsd: disable distcheck for the failing bindings/python target 2019-01-15 Reini Urban free: fix -Wshadow for static dat use local dat's json: fix asan dynamic-stack-buffer-overflow too small alloca, also switch to heap on overlarge alloca (security) api: add get_{first,next}_owned_subentity iterator .gitignore: more 2019-01-14 Reini Urban configure: print PERL version not just logging to config.log api: add dwg_model_space_object(dwg) with all the checks, needed for dxf_blocks_write() json: fix \u00XX cquote and FIXME/skip surrogate pairs, U+10000+ chars. A lone low or high pair is forbidden, TODO. These mostly came from invalid binary chunk anyway. It fixes the json tests with --enable-debug cirrus: try python again m distdir: don't know how to make ./LibreDWG.py examples: speed-up make distdir alldwg.inc doesn't need to be generated there, make regen-unknown is enough. 2019-01-10 Reini Urban dxf: EMC color.rgb & 0x00ffffff only out_dxf needs to filter the type from the rgb value, in_dxf not. dxf: color.index & 255 256 would be 1 then. AcDbHatch(1C48E9): Color index 65535 AcDbVisualStyle(F4): Color index 3368 ... MATERIAL: add ownerhandle, REACTORS, XDICOBJHANDLE and add the mandatory DXF fields. 2019-01-09 Reini Urban alive.test: speed up only -v2. not -v4 needed. from 32.7s to 11.4s dxf: improve mspace dxf_blocks_write esp. for some r2010+ dwgs regen-unknown with the new DXFs 2019-01-09 Reini Urban test-data/2007: add missing DXF files XRECORD and DICTIONARY circle.dxf is wrong with ODA and our decoder. Check against acad versions dxf: skip XRECORD xdata 80-90 These are most likely decode errors, and throw dxfin errors. But the circle_2007 XRECORD's all look wrong. dxf: _HATCH_gradientfill, fix dxf 91=>93 WIP num_polypaths is 93 add missing str_dat to DWG_ENTITY decls. 2019-01-07 Reini Urban python: probe also without swig many checks need python. alive.test: dwggrep -c now returns 21 The block_header iterator get_next_owned_entity finds now more. fixup get_next_owned_entity check the actual entity owner. it did fail with some r14-2000 attribs, belonging to 2 separate block headers 2019-01-07 Reini Urban dxf: skip *Model_Space BLOCK entities check ptr and index; improves 7cad11cc68887b, the ptr check is sometimes not good enough. Skip all block entities which are owned by *Model_Space. Some newer entities (UNDERLAY, MLEADER) are under some other blocks (e.g. pspace) but owned by mspace. 2019-01-07 Reini Urban decode: apply dwg_validate_POLYLINE/INSERT after having read the SEQEND, to fill in a missing owner->seqend handle. Fixes the r2010+ SEQEND errors. 2019-01-05 Reini Urban move dxf_is_sorted_POLYLINE to decode as dwg_validate_POLYLINE(), yet unused. Needs to be called after the last POLYLINE entity was read, which is not clear. 2019-01-05 Reini Urban dxf: skip *Model_Space UNDERLAY entities The *Model_Space BLOCK contains UNDERLAY's, but they only appear in the ENTITIES section, not as BLOCK entity. Ditto for all other *Model_Space entities. Error with INVALIDDWG when the BLOCK_HEADER contains no BLOCK entity. 2019-01-05 Reini Urban dxf: remove is_sorted, always process with subentities This logic was too fragile, esp. vs BLOCKS api: add dwg_obj_is_subentity 2019-01-05 Reini Urban api: rename get_*_owned_object to _entity get_next_owned_object only returned the next block entity, not any object associated and located in this block, and neither any VERTEX/ATTRIB. esp. since r2004+ with its BLOCK_HEADER.entities array. This skips objects and subentities (ATTRIB, VERTEX). Add API docs for these 2019-01-05 Reini Urban dxf: process VERTEX r2004+ get_next_owned_object returns the next main entity, no VERTEX. set is_sorted=0 then, forcing dxf_process_* for subentities then. api: add get_last_owned_block() to return the ENDBLK for a BLOCK_HEADER. use it in dxf dxf: split BLOCKS and ENTITIES (#88) WIP ENTITIES only if owned by MSPACE, all other as BLOCK members. BLOCKS contains all pspace entities, and all blocks, but no objects. OBJECTS contains all objects but BLOCK_HEADER and *_CONTROL (TABLEs) 2019-01-04 Reini Urban --disable-bindings (#86) dxf.test: clear *dxf.log DICTIONARY: fix hard_owner DXF 350/360 and emit it for DXF dxf: fix XRECORD xdata, no +1000 XRECORD xdata has normal dxftypes 2019-01-03 Reini Urban dxf: BLOCK_NAME via cvt_blockname for pre-R13 names $MODEL_SPACE <=> *Model_Space 2019-01-02 Reini Urban dxf: fix EED/xdata dxfcode + 1000 2019-01-02 Reini Urban VALUE_HANDLE: harmonize to 4 args for the name logging. Caused by the effort to emit a 340 0 DXF pair for a BLOCK_RECORD layout_handle on NULL. 2018-12-31 Reini Urban dxf: skip more VERTEX_2D defaults 2018-12-30 Reini Urban VPORT: revert shade_plot_handle back to 361 sun_handle several DXFs have the sun there 2018-12-28 Reini Urban free: protect empty TABLE ent with --enable-debug and HANDLE_VECTOR overflow. Actually set an invalid size field to 0 debug: more missing api DECLs with --enable-debug classes debug: more missing SUB_FIELDs with --enable-debug classes dwg_dim_blockname: treat DICTIONARY as LAYER some DWGs: 2013/gh55-ltype.dwg dxf: protect wrong HATCH.num_path and cast some NULL ptrs, and wrong formats dxf: more codepages add ANSI_1253, ANSI_1254, ANSI_936, ANSI_949 2018-12-27 Reini Urban multiple definition of alloca only complaint on freebsd dxf: cquote dxf_fixup_string for newlines and such (text 1) different quoting rules than json dxf: fix VERTEX sub classing tested ok dxf: fix 3DSOLID, BODY subclass names dxf: fix _3DSOLID,_3DFACE dxfname special case it in DXF and decoder api: add DIMENSION.flag from flag1 and flag2 calculate the DXF value 70 (some bits from flag1 and 2) skip empty DXF user_text (at least ASCII for now) dxf: support DIMSTYLE 3 dxf: add DIMSTYLE 3, skip 52 move 3 to COMMON (before the subclass) skip DXF 52 ext_line_rotation: invalid improve dwg_dim_blockname sometimes a LAYER is mixed in dxf: add FIELD_BINARY for picture 310 dxf: add HATCH.boundary_handles 330 out_dxfb: sync with out_dxf dxf: HATCH.elevation as pt 2018-12-26 Reini Urban dxf: style name 7 before the subclass examples: add alldwg.inc to dist to avoid regen-unknown on make distcheck, and to ship it with the tar dxf: fixup empty POLYLINE.seqend with +1 obj don't try the other variant then, also to avoid a leak. dxf: write empty HANDLE_NAME otherwise DXFIN complains. e g $DIMBLK 2018-12-26 Reini Urban dxf: destructive i++ for the loop the unsorted process handlers need to advance the loop variable, otherwise we process some entities them twice. Closes #83 2018-12-26 Reini Urban dxf: sort INSERT-ATTRIB-SEQEND (#83) use one global/static is_sorted variable, for both POLYLINE and INSERT, both ended by SEQEND. add type and NULL checks in the dxf_process_##token() handler. reset is_sorted to the default 1. 2018-12-26 Reini Urban dxf.test: extend SEQEND check also to INSERT-ATTRIB (#83) which fails on example_20* cirrus: only allow master + smoke/* cirrus: --disable-python for the xmlsuite/check.py fixup empty SEQENDs in dxf is_sorted_POLYLINE in the decoder it is too early, so do it in one of the outputters. the empty SEQEND is an artefact of the previous decoder shiftup, the real fix would be a correct handlestream_offset (#85) decode: check_POLYLINE_handles check for if vertex[0] is the layer and shift the vertices then. since we cannot look forward and resolve unread objects its not yet good enough. we really need to check them after the seqend or last vertex. or later in out_dxf in the is_sorted_POLYLINE check. decode: log relative handle stream offset it is still wrong. see #85 indent common_entity_handle_data.spec dxf: protect wrong FIELD_HANDLE_NAME table when a handle points to a wrong object 2018-12-25 Reini Urban POLYLINE_3D: rename flag2 to curvetype (75) 2018-12-25 Reini Urban dxf: WIP is_sorted_POLYLINE shortcut (#83) COMMON_ENTITY_POLYLINE: ensure that the common POLYLINE_* fields are shared with all 4 types. Some vertex[] handles are even worse than a wrong SEQEND, check when the first vertex[0] is corrupt and ignore it then. enable loglevel LOG in out_dxf, mainly to warn about this wrong POLYLINE.vertex[0] handle %lX < %lX 2018-12-25 Reini Urban dxf: POLYLINE - SEQEND - VERTEX (#83) Some dwg's (r2007, r2018) have the SEQEND following the POLYLINE. Iterate over the vertex handles, not over the object id's. shellcheck json.test and regen-unknowns 2018-12-25 Reini Urban bindings: add missing Object APIs parallel to the Entity getters and converters, recently added to dwg_api. remove some DEBUG_CLASS function from the public api (getall, converter) 2018-12-25 Reini Urban cirrus: re-enable python, install py36-libxml2 instead suffix.inc: _XOPEN_SOURCE 700 for snprintf on FreeBSD. Sets __ISO_C_VISIBLE 1999 bindings: honor --disable-python m4: fix swig and python probes for FreeBSD swig defaults to swig3.0 on FreeBSD pkg python needs proper LDFLAGS (-lpthread) and SYSLIBS (-lm) use $SWIG in Makefile dxf.test: bash => sh no bashisms, checked with shellcheck .cirrus: install bash, --disable-python bash needed for dxf.test py36-lxml (the libxml2 binding) needed for xmlsuite, but the xmlsuite/check.py is failing with python3.6 with --disable-python only distcheck is failing on binding/python 2018-12-24 Reini Urban fix dxf.test for FreeBSD where bash is in /usr/local/bin 2018-12-23 Reini Urban dxf: emit 62 256 or 420 rgb if index not 256. See MLINESTYLE dxf: reorder MLINESTYLE 3 <-> 70 fields it is apparently critical dxf: some classes are builtin since r2004+ ACDBPLACEHOLDER and LAYOUT do not appear in CLASSES anymore, but it depends which version exports it. dxf.test: add check_acdb_dxfname decode: set proper dxfname from classes.inc STABLE_CLASS_DXF (also for the importers), and from dwg_add_##token (for the API). Fixes ACDBDICTIONARYWDFLT DXF object and simplifies out_dxf. dxf: use ACDBDICTIONARYWDFLT no dxfname set? add programs/dxf.test a few minor failures, but was important to catch missing layers. it doesn't check diff error codes yet. dxf: more missing common_entity_handle_data r2004+: read layer, ltype (was missing) skip dxf color 62 256 put dxf 330 ownerhandle after reactors print empty layer (wrong handle stream e g POLYFACE_MESH) as 0 handle other .spec fields if undefined (e.g. VALUE_HANDLE in common_entity_handle_data) dxf: entity.ownerhandle 330 after ACAD_REACTORS test-dxf.sh: no gmake log: add [H ] type to handle logs api: rename _ent->entity_mode to entmode. (as in the ODA docs) add proper pspace owner handling in DXF fix common_entity_handle_data encoding of ownerhandle: skip if implied by entmode. cur_owner tracking is not needed anymore. entmode is enough api: replace ENTITY.subentity by ownerhandle 330 this handle really is the ownerhandle, not the subentity. it only appears in subentities (VERTEX, ATT*) pointing to its owner. Now we don't need the cur_owner/old_owner anymore. make regen-unknown now with ODA generated 2000_dxf.log counterpairs add PolyLine2D .dxg/.dxf pairs for VERTEX_2D and VERTEX_3D samples (which crash on DXFIN import) decode VALUE_HANDLE_N: [vcount]: NULL HANDLE itemhandles[vcount]: NULL HANDLE(2) [0] vs itemhandles[vcount][15]: 2 HANDLE(2.1.66) absolute:66 [0] 2018-12-22 Reini Urban dxf: add dwg_dim_blockname (#81) need to out_dxf more blocks: anon. *Dn for DIMENSION. Get the name from the BLOCK_HEADER - BLOCK.name, following the DIMENSION. Now simply dump all BLOCK and BLOCK_RECORD's. 2018-12-22 Reini Urban dxf: fixup AcDbBlockTableRecord name (#81) for ccd50fd121544c0c3a638b1d5c5512083bdf3df3 dxf: Error in BLOCK_RECORD Table Did not receive AcDbBlockTableRecord name dxf: Did not receive AcDbViewportTableRecord flags dxfin error. the flag 70 is not optional with COMMON_TABLE_FLAGS api: rename parenthandle to ownerhandle (#80) 2018-12-22 Reini Urban change _ent->owner to ownerhandle entities gets realloced, and thus their pointers invalidated. we need to store the BITCODE_H ref instead. valgrind: Invalid read of size 8, dwg_dxf_ENDBLK, dxf_blocks_write. add reverse dwg_find_objectref lookup: linear search, only done for entities with subentities to find the ref for the current object 2018-12-22 Reini Urban dwg_dxf_STYLE: fix TU memleak free temp. bit_convert_TU result dxf: fix dxf_cvt_tablerecord memleak free temp. bit_convert_TU result decode: use after free when dwg_decode_UNKNOWN_ENT failed and freed dat. dwg2dxf: call free within valgrind fixes some articial memory leaks dwg_add_TOKEN: potential obj->tio.object mem leak dxf_tables_write: fix potential NULL deref very unlikely, but still dxf_free_pair: fix NULL deref decode: dead increment error from obj_string_stream was ignored decode: dead assignment 2018-12-21 Reini Urban decode HANDSEED: protect from empty handle Fixes most dxf roundtrips, where HANDSEED turns up empty. Only a few DXFs break now on dxf-roundtrip's dxf: use proper AcDbBlockTableRecord name (#81) Not the BLOCK_HEADER.name (which is only *Paper_Space) but the name of its BLOCK entity (which is *Paper_Space0). This fixed most #81 dxfin errors, but not all. dxf: all BLOCK_HEADER records analog to the pspace BLOCK objects, some are missing. Note that the basic dxfs survive now a teigha roundtrip. dxf: no r2004+ color 62 index 0 TODO: lookup the index for rgb color (e.g. 7 for 0xc3000007) index is invalid dxf: add dxf-roundtrip.sh via TeighaFileConverter. dwg2dxf for a DWG, convert it back to a DWG via Teigha to see if the DXF is somewhat correct, and then read the converted DWG. Create Teigha error logs as .dwg.err dxf: rename dxf_example to dxf-allcvt we are mass-converting all DWGs to DXFs, and then use a LSP to DXFIN all those generated DXFs. dxf: more missing PSPACE blocks (#81) The first attempt 975c8f3deb was unsuccessful. There may be unconnected pspace blocks not referenced by the BLOCK_CONTROL, such as pspace blocks from a pspace LAYOUT, so for simplicity just scan all BLOCK_HEADER's for a pspace block. 2018-12-20 Reini Urban dxf: rename new ent->parent to ent->owner (#82) its confusing both ways. the corresponding object ptr is called parenthandle, but the obj->parent is something else: inheritance. officially we have hard and soft owners, owning the reference, for liveness on deletion. in the end it would be just too confusing mixing up the _obj->parent and obj->parent with _ent->parent. maybe rename _obj->parenthandle to ownerhandle also. 2018-12-20 Reini Urban dxf: Support 330 ent->parent->handle (#82) which is not always the MSPACE record. On subentities (VERTEX, ...) it is the parent. 2018-12-19 Reini Urban dxf: add missing PSPACE blocks (#81) also iterate over the block_headers array of the first BLOCK_CONTROL, which are usually PSPACE blocks. api: rename DIMENSION_ORDINATE.ucsorigin_pt to def.pt move def_pt to DIMENSION_COMMON, add blockname field 2018-12-19 Reini Urban fix bit_convert_TU for >U+800 (#80) wrong UCS-2 to UTF-8 converter: fix the first byte of a 2 and 3-byte sequences only found out with chinese drawings 2018-12-19 Reini Urban dxf: more POLYLINE_2D,VERTEX_2D defaults default values are left out in DXF dxf: more common_entity_data defaults default values are left out in DXF dxf: more POLYLINE_2D work WIP extrusion is a vector on DXF. BE can be skipped on DXF if default. But acad still crashes on DXFIN (2DVertex) make regen-swig-patch 2018-12-19 Reini Urban add dxf_cvt_lweight, rename linewidth to linewt (#79) The DXF output of CELWEIGHT/linewt needs to be decoded to some signed int, the 100th of a mm, and 3 special default values -1 .. -3 for dxf. (BYLAYER, BYBLOCK, BYLWDEFAULT) This fixes DXF import with lineweights. Rename the API to linewt for consistency. 2018-12-18 Reini Urban dwg_decode_handleref: obj NULL deref Empty obj argument for code >= 6 suffix: Argument with 'nonnull' attribute passed null empty filename dwgread: Argument with 'nonnull' attribute passed null protect against empty outfile (only a theoretical getopt problem) read_R2004_section_info: NULL deref Array access (via field 'sections') results in a null pointer dereference in_dxf: Argument with 'nonnull' attribute passed null protect pair clang-analysis: Allocator sizeof operand mismatch Result of 'calloc' is converted to a pointer of type 'unsigned char', which is incompatible with sizeof operand type 'char'. 2018-12-17 Reini Urban json: fix wcquote format tmpl %s => %ls dwgwrite: fix wrong infile check (#77) Thanks to @shlyakpavel fix dwggrep NULL deref (#77) Thanks to @shlyakpavel fix NULL deref (#77) added recently. Thanks to @shlyakpavel 2018-12-17 Reini Urban json: add SUB_FIELD, REPEAT_BLOCK. fix LEADER Need to separate the parent[i] from the struct field. arrays esp. in json should not print field[rcount1]: value, just an array of values. With REPEAT an array of structs. Also set a few more missing parents, and fix LEADER subelements: allow multiple 2018-12-17 Reini Urban json: add HANDLES object map But not the relative offset, just the absolute offset. We don't yet store the DWG relative offset. json: add preview, handle, owner, dxfname Add some more missing fields json: skip duplicate BLOCK.name FIELD_T (name, 2) already prints the name skip the duplicate dxf group 3 with the name doc: enhance json docs 2018-12-16 Reini Urban silence gcc -Wlogical-op && len => && len > 0 warning: logical ‘and’ applied to non-boolean constant api: rename TABLE.entry_name field to name Closes #76 2018-12-16 Reini Urban json: 2007 text fixes disable wrong color.name and bookname fields. They are all wrong. r14 might have NULL reactors. make check passes now 2018-12-16 Reini Urban json: probe for jq, add tests 2018-12-15 Reini Urban json: more DWG like structure Rename ENTITIES to OBJECTS, moved preview before header (vars). TODO: FILEHEADER sections, object map. See #76 2018-12-14 Reini Urban fix 2 test/*/ole2frame types -Wsign-compare (detected only on cygwin) 2018-12-14 Reini Urban json: final fixes add more cquote rules, esp. \n escape more unicode stuff <0x1f as \u00xx skip the very last COMMA in ENTITIES ENDSEC. add {} around FIELDs, so that VERSION(R_14) FIELD_RC (hard_owner, 0) will not only skip the PREFIX block. add proper PREFIX for FIELD_2DD_VECTOR. jq can now read the generated json, when being written to a file, not a pipe (NOCOMMA hack skipping the last comma of a list) 2018-12-14 Reini Urban Add alloca workaround: _alloca or malloc needed for out_json and examples/unknown. Windows MSVC defines _alloca in malloc.h 2018-12-13 Reini Urban json: cquote strings now only Invalid string: control characters from U+0000 through U+001F must be escaped are missing json: produce better output WIP but still not JSON conformant. make HEADER a hash. better ARRAY, POINTS, VECTORs. HACK: skip dquotes on classnames wiich are already in dquotes. TODO escape it properly. 2018-12-13 Reini Urban json: use DXF_OR_PRINT blocks (#73) Most entities only have DXF, DECODER and ENCODER blocks defined (e.g. LINE) but no special PRINT block, which would be needed for all other formatter outputs. For easier spec go with the DXF_OR_PRINT block then, and define it for those formatters IS_PRINT settings. This fixes out_json with only IS_PRINT but no IS_DXF action. We don't want to duplicate DXF {} blocks for PRINT. And those formatters also go into both directions, in and out. Thanks to @nick-bull for asking about this. Closes #73 2018-12-13 Reini Urban encode: add WIP dwg_section_page_checksum for writing a r2004+ section map. untested. more crc work: crc64 and crc32 rename 2004_file_header.CRC to crc32, format crc64 properly (leading 0), add crc32 code (generated crc32 table) for r2004+ (for file header), not the crc64 code yet for r2007+ (for compressed pages), rename some internal old libdwg vars from crk to crc. Add handles section CRC check This CRC is LE (not byte-swapped). fix testcases/bits_test.c on 32bit use better MC/UMC test values: 0x8777 7777 instead of 0x2111 1111 causing the previous 4bit lossage. beware of uint32 wraparound causing an endless loop (cygwin32) 2018-12-12 DenisPryt Restore dat position in dwg_decode_add_object for all return cases 2018-12-12 Reini Urban dxf: fix CELWEIGHT values from https://sourceforge.net/p/libdwg/tickets/7/ CELWEIGHT is encoded into special values. Thanks to Guruprasad Rane for the value translations. Add logging for some calculated values 2018-12-12 Reini Urban print HANDSEED as hex handle as AUXHEADER RL, and as HEADER handle. See #71 2018-12-12 Reini Urban change MC back to long document and simplify MC bits Explain why 4 byte are not enough. on 64bit MC offsets just need to be natural. Add more MC and UMC tests. Closes #70 2018-12-12 DenisPryt read/write bit_MC/UMC fix (max byte length change from 4 to 5) See #70 2018-12-12 Reini Urban fixup read_2004_compressed_section messages Fix wrong logging messages for the section types. Not Class, but OBJECTS and HANDLES mostly. 2018-12-11 Reini Urban swap CRC type to RSx not RS_LE. Now only the r14,r2000 Section[0] CRC fails, a known problem. relax the WRONGCRC error with those. 2018-12-11 Reini Urban bits: change BITCODE_MC/MS from long to int32 we are not on 32bit anymore. also add read_200{4,7}_section_handles and breaks bits: use BITCODE_* types not the intsize dependent long unsigned int dxf: guard empty table ctrl objects 2018-12-11 DenisPryt Add r2007+ obj_string_stream overflow guard 2018-12-11 Reini Urban SPLINE/HELIX: set parents We cannot use FIELD_VECTOR with 3BD here unfortunately perl: fix make check use LD_LIBRARY_PATH, not LD_RUN_PATH to be able to find libredwg.so.0 2018-12-11 Reini Urban CLANG_DIAG_IGNORE(-Wpragma-pack) -Wpragma-pack is clang-only silences test/testcases/decode_test warning: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] The gcc variant would be -Wpragmas, which is not needed here: -Wno-pragmas -Wunknown-pragmas 2018-12-11 DenisPryt Reini Urban Object-map section_handles: handle is BITCODE_UMC unsigned, not signed. confirmed with libdxfrw encode: obj->handlestream_size needs to be encoded as UMC also. (forgotten in encode r2010+) 2018-12-11 Reini Urban extend bits_test print more bits and fail result 2018-12-11 DenisPryt free -> FREE_IF migration 2018-12-10 DenisPryt Error on zero section max_decomp_size (#66) 2018-12-10 DenisPryt Reini Urban read_R2004_section_info buffer overflow protection (#68) Fix decode R2004_header encryption section. 2018-12-10 DenisPryt typo fix Pruchkovksy -> Pruchkovsky 2018-12-10 Reini Urban r11: add OSMODE even if stored in DXF as zeroed value 2018-12-10 Reini Urban Revert "Renamed HEADER.MENU to HEADER.MENUNAME" The DXF file has it as $MENU, so it was correct. The DXF docs are just wrong. This reverts commit 419f4eade8d9b32942a1d0a26097081f09a54c71. 2018-12-09 Reini Urban Renamed HEADER.MENU to HEADER.MENUNAME MENU is the command, but MENUNAME is the variable name 2018-12-07 DenisPryt Fix unknown class free problem 2018-12-06 Reini Urban Harmonize Dwg_Leader_ subtype names Dwg_Leader_* => Dwg_LEADER_* Dwg_MLeaderAnnotContext => Dwg_MLEADER_AnnotContext 2018-12-05 Reini Urban Release 0.7 add .cirrus.yml for FreeBSD CI fix python 3.6 TabError meta: fixup authorship headers load_dwg.c: decl strdup 2018-12-05 Reini Urban api: convert IMAGE.size.{width,height} to 2RD no inline structs in WIPEOUT and IMAGE. convert inline struct { width; height } to 2RD (x,y). The size is documented as size (u,v), not width/height in the AutoCAD DXF docs. This is mostly to simplify the dynapi #59 xmlsuite: simplify newxml.py remove unused local var xmlsuite: simplify check.py remove unused imports 2018-12-04 Reini Urban examples/bits: initialize pos pos -Wmaybe-uninitialized in return decode(dat, pos, size) detab all sources some editors are obviously confused about tabs Protect from calloc(0,) returning non-NULL (#61) when info->num_sections == 0 (on some broken DWG), calloc(0,...) might return a non-NULL ptr on some broken libc's (glibc). This is a better fix than on PR #61, thanks @DenisPryt for finding the problem. 2018-12-03 Reini Urban alive.test: use libtool for 2nd dwggrep test pre-r13: set LAYER,STYLE flag bits set on,frozen,frozen_in_new,locked bits from LAYER flag, shape_file,vertical from STYLE flag. pre-r13: set BLOCK_HEADER flag bits anonymous,hasattrs,blkisxref,xrefoverlaid from flag. to unify the api smoke: CFLAGS typo 2018-12-02 Reini Urban NEWS: add latest changes for 0.7 guard get_first_owned_object first_entity ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f782e1db8b5 bp 0x7fffb a38ff70 sp 0x7fffba38ff50 T0) The signal is caused by a READ memory access. Hint: address points to the zero page. #0 0x7f782e1db8b4 in get_first_owned_object /home/rurban/Software/libredwg/src/dwg.c:748:34 #1 0x5048fb in output_BLOCK_HEADER /home/rurban/Software/libredwg/programs/dwg2SVG.c:211:9 #2 0x50453d in output_SVG /home/rurban/Software/libredwg/programs/dwg2SVG.c:252:3 #3 0x50453d in main /home/rurban/Software/libredwg/programs/dwg2SVG.c:361 add missing _private decls fixup _VECTOR_CHKCOUNT for REACTORS macros A minimal HANDLE (i.e. a NULL handle) need much less bits than 8 2018-12-02 DenisPryt Add _VECTOR_CHKCOUNT to REACTORS macros. 2018-12-02 DenisPryt Add dwg_decode_add_object_ref function for adding Dwg_Object_Ref. Revert dwg->object_ref pointer to old state if realloc is failed. Fix Dwg_Object_Ref leaks. 2018-12-02 Reini Urban fixup TABLE DWG_ERR_INVALIDTYPE error Table_Value sets DWG_ERR_INVALIDTYPE, check it and return the sum of all errors. 2018-12-02 DenisPryt call END_REPEAT before return inside a loops fix 3dsolid memory leak switch dwg_decode_##token##_private function from EXPORT to static returned dwg objects non-fixed types values to its original state Fix memory leak objects with invalid handleref code Guard function in dwg_free_ ##token for all frees in DWG_ENTITY_END and DWG_OBJECT_END Guard function for free(str_dat) in decode object and entity macros DWG_TYPE_FREED collision free: several fixes Fix eed free on eed decode error. Objects with unknown handleref.code don't remove from dwg->object_ref array. Fix read_system_page space allocate. Free Bit_Chain in read_2007_section_header and other. 2018-11-30 Reini Urban LEADER fields fixup more fields: switch path_type with annot_type rename hooklineonxdir to hookline_dir rename unknown_bit_4 to hookline_on fixup DXF values LEADER.endptproj <= r2007 most likely. there are still discrepancies with the DXF. The ODA spec is wrong for sure. i.e. box_width,box_height is rather a 213/223/233 3DPOINT DXF 340 is also missing doc: add dwg_get_ API and some more fixups rename internal macro GET_DWG_* to DWG_GET_ to better reflect the external API names dwg_get_ and dwg_get_. add GET_DWG_OBJECT for all objects in a DWG analog to dwg_get_ENTITY, but including all objects, tables, block headers, even if unowned. 2018-11-29 Reini Urban fix GET_DWG_ENTITY (#60) Either the last member of the array needs to be NULL, or we need to return the count. Since we don't want to change the API, we NULL-terminate it. We also need to guard from an empty BLOCK_HEADER argument. 2018-11-29 Reini Urban AUTHORS: add Denis Pruchkovsky (Pryt) 2018-11-28 Reini Urban fixup VECTOR_CHKCOUNT overflow (#56) all values need to stay signed, just promote them to long long for the checks. 2018-11-28 DenisPryt fix VECTOR_CHKCOUNT overflow (#56) VECTOR_CHKCOUNT cast bit size to long. As result big numbers is multiplied by 8 and becomes negative 2018-11-27 Reini Urban dwglayers: fix DICTIONARY loop (#51) skip a DICTIONARY, but don't skip the loop. Fixes #51 dxf: fix empty paper_space (#52) Fixes dxf_blocks_write #52 2018-11-27 DenisPryt Reini Urban Fix multileader bug. vertexes should be array. Renamed vertexes to points analog to LEADER. Closes PR #49 2018-11-27 Reini Urban fixup BITCODE_RC* vs char* fix -Wpointer-sign and -Wincompatible-pointer-type warnings. strings are still char* bump to 0.7, prep NEWS ChangeLog We had to change the API in the previous commit, RC is now unsigned char Fix LTYPE.dash, change RC to unsigned char avoid such negative values. Fixes #44. This changed the API, thus we must bump to 0.7 fix FIELD_NUM_INSERTS Only allow RC 1 bytes, backup when != 1. Fix encode for FIELD_NUM_INSERTS, write a vector of 1 bytes. Fixes the example from #44 for the first wrong num_inserts case. decode FIELD_NUM_INSERTS: log -v5 values The ODA spec seems to be wrong, see #44 fixup format type for size from the previous PR #48 2018-11-27 DenisPryt Fix image decode: rectangle or polygon flag mistake 2018-11-26 Reini Urban Fix LTYPE.dash, change RC to unsigned char avoid such negative values. Fixes #44. This changed the API, thus we must bump to 0.7 fix FIELD_NUM_INSERTS Only allow RC 1 bytes, backup when != 1. Fix encode for FIELD_NUM_INSERTS, write a vector of 1 bytes. Fixes the example from #44 for the first wrong num_inserts case. decode FIELD_NUM_INSERTS: log -v5 values The ODA spec seems to be wrong, see #44 fixup format type for size from the previous PR #48 2018-11-26 Denis Fix error with eed size (#48) 2018-11-24 Reini Urban Enable LGTM support (#46) https://lgtm.com/projects/g/LibreDWG/libredwg/ 2018-11-23 Reini Urban examples: improve load_dwg.py don't fail on non-critical errors don't import twice 2018-11-23 Reini Urban Fix VECTOR_CHKCOUNT segfault on unassigned obj->dxfname's (esp. for <=R12). Fixes #44. also rename the error message: vcount is only relevant for vectors, but it is also used for strings. 2018-11-23 Reini Urban free: refactor VALUE_HANDLE same logic as in decode. obj is NULL inside header_variables.spec. but still some wrong handles are leaking. less calloc(0) calls these appear in valgrind as 0 size leaks 2018-11-23 DenisPryt Reini Urban abstract dwg_decode_eed_data, fix eed segfault #45 move the inner eed loop into its extra function. end ignored last size = bit_read_BS(dat), which must be zero. If eed section is present and corrupted, happens seek into end, and return inside a while loop. As result, we missed the last size = bit_read_BS(dat) in while condition. This also fixes most of the last remaining memory leaks, just a few stale handles are left. 2018-11-23 DenisPryt Avoid reactors calloc(0) 2018-11-23 Reini Urban CONTRIBUTING: add link to (c) assignment form in_dxfb: harmonize with in_dxf 2018-11-22 Reini Urban unknown: more work on LOFTEDSURFACE 2018-11-20 Reini Urban NEWS for latest changes free: fix double-free with subentity handle in UNKNOWN_ENT such handles are already freed with object_ref[] Fixes #43, detected by DenisPryt free: fix decompress_R2004_section leak in case of critical errors check RUNNING_ON_VALGRIND and probe for include which is helpful when testing memory leaks with bigger DWGs. It formerly just skipped dwg_free. Now call dwg_free when running under valgrind free: fix R_2007 data_page leaks free the data_page's, which can be several KB, even MB on larger DWGs free: eed in UNKNOWN_OBJ which is still stored into the Dwg_Object_Object struct. fixes MATERIAL eed leaks, et al. hash: fix Uninitialised value valgrind: Conditional jump or move depends on uninitialised value(s) at 0x1E006E: hash_set (hash.c:137) by 0x19A9E9: dwg_decode_add_object (decode.c:3813) by 0x1A59A4: read_2004_section_handles (decode.c:2094) by 0x1A59A4: decode_R2004 (decode.c:2224) by 0x1A798F: dwg_decode (decode.c:223) by 0x10A81C: dwg_read_file (dwg.c:186) by 0x10A470: main (dwgread.c:214) Uninitialised value was created by a heap allocation at 0x483577F: malloc (vg_replace_malloc.c:299) by 0x1DFED1: hash_new (hash.c:28) by 0x1A77C7: dwg_decode (decode.c:135) by 0x10A81C: dwg_read_file (dwg.c:186) by 0x10A470: main (dwgread.c:214) fix C99 compat, rename null malloc errors fix some -Wdeclaration-after-statement from PR #42 Rename the api null malloc errors to Out of memory for consistency free: avoid double-free of obj->tio.unknown when it is not a class fix LAYOUT memory leak >=R_13 SINCE R_13 LAYOUT is a class, free it. The previous EED double-free cannot happen, as we NULL it now. Todo: But there are still missing EED, esp. with UNKNOWN_OBJ 2018-11-20 DenisPryt Bit_Chain initialization in programs 2018-11-20 DenisPryt Some trivial warning and crash fixes bracers in defines (out_geojson.c), fix parameters to fwrite, add Bit_Chain initialization, read section name according to name_length, free section name, check num_pages for zero avoiding malloc(0), fix possible memory leaks in dwg_api.c and reedsolomon.c bfr_read_string: add 2nd size argument minor fixups 2018-11-07 Reini Urban Release 0.6.2 make regen-man .appveyor.yml: post-release version bump HACKING: add make release paragraph Update NEWS and ChangeLog for 0.6.2 prep 2018-11-06 Reini Urban fix minor warnings vcount: -Wsign-compare case DWG_TYPE_VBA_PROJECT: -Wimplicit-fallthrough fix several dxf segv with empty ctrl blocks or tables. Fixes [GH #39] Fix one more 2035 section size limit With the example from [GH #39] Merge branch 'DenisPryt-master' 2018-11-06 DenisPryt Fix section size limit Fix eed decoding when end - dat->byte == 1 2018-11-06 Reini Urban unknown: regen 2018-11-05 Reini Urban Release 0.6.1 See NEWS spec: fix wrong FIELD_2DD_VECTOR in dwg decode The 2nd .y coord was wrong. Found by @soundd1 [GH #40]. 2018-08-30 luzpaz Misc. typos and whitespace fixes Found via `codespell -q 3`. 2018-08-13 Reini Urban post-release 0.6 doc updates This should have been done for 0.6 already... Release 0.6 See NEWS 2018-08-13 Reini Urban Release 0.6 2018-08-12 Reini Urban free: not the static strings but all the others free: DECODE_UNKNOWN_BITS free the unknown_bits free: DEBUG_HERE_OBJ decode: clean vectors calloc them, not just malloc. dxf: more empty vector protections in this case ASSOCNETWORK dxf: fix -Wpointer-to-int-cast warning encode: protect empty vectors with DEBUGGING or UNSTABLE classes vectors can easily be unallocated encode: BITCODE_BL sizes configure: keep CFLAGS on --enable-debug e.g. -I/usr/local/include is needed for dwgps just remove -O2 dxf: cast SURFACE to 3DSOLID dwggrep: add new objects 2018-08-11 Reini Urban beautify valgrind version fix -Wstringop-truncation in strncpy strncpy specified bound 255 equals destination size fix -Wdouble-promotion, use our bit_isnan don't use the math.h long double promoting isnan check, at least on clang. add separate signed BLd type #36 We just changed BL to signed. revert that and add a separate BLd to represent the two such dxf ranges. BL as signed is a problem for vcount/rcount overflow detection with negative values. Closes GH #36 unknown: add DEBUGGING ACSH_SWEEP_CLASS ACDBNAVISWORKSMODELDEF ACSH_SWEEP_CLASS is probably the dbSweepOptions.h class no coverage for ACDBNAVISWORKSMODELDEF (BIM_DICT entries) add examples/bits: all possible values/types not just the most likely as with bd bd: print most possible types and values rm duplicate logs.sh and log.sh we already have log and logs-all.sh 2018-08-10 Reini Urban add examples/bd to print the BD value of bits move HELIX to UNSTABLE found all the missing fields. It's a spline. bd-unknown.inc helped a lot. unknown: add some bd-unknown doubles they do work 2018-08-10 Reini Urban add examples/bd-unknown.inc to fixup wrong binary repr. of doubles, if found by some manual heuristic this is the initial empty set of all wrong BDs (with removed duplicates) 2018-08-10 Reini Urban dwggrep: skip 3DSOLID encr_sat_data This makes not much sense, rather search the decrypted variant. It also read from uninitialized memory make regen-swig-patch 2018-08-09 Reini Urban unknown: integrate 3DSOLID into SURFACE search for "ACIS BinaryFile" revealed an ordinary ACIS v2 SAB format right at the beginning of each SURFACE. Ensure a common binary layout for both, as we cast the SURFACE into 3DSOLID for decoding. Update 0.6 NEWS 2018-08-08 Reini Urban unknown: LDADD and LTEXEC fixes for shared link to bits and common explicitly. most functions there are not exported. fix LTEXEC: use unexpanded \$top_builddir. This is needed for a Makefile and a script. 2018-08-08 Reini Urban unknown: LIGHT looks good now fix plot_glyph, color, no hole left. unknown: regen-unknown alive.test: skip libtool on --disable-shared skip Unstable|Unhandled Class warning on print or free action. Only relevant for decode or encode really support non-decode for common_entity_data.spec enable encode and DXF support. simplify CMC color fields: rgb and alpha masks unknown: re-sort per file keep the objects from one file together fix parallel picat skip libtool --mode=execute on --disable-shared fix the dirname of examples/unknown with libtool. fix parallel picat 2018-08-07 Reini Urban skip incompatible moreutils parallel this does not support the {} and ::: syntax, rather uses -- for arg separation, and I still have to find out the {} and {/.}_{//} macros. we want the GNU parallel (in perl) 2018-08-07 Reini Urban add log script usage: ./log -v5 2004/Leader example_2000 use parallel and timeout as probed use logs-all-serial.sh or logs-all-parallel.sh probe for PROGS versions not just to the log, display it. picat, timeout, parallel, valgrind. add timeout, parallel probes. more EMC tryouts WIP unknown: fix cquote final 0 cquote forgot to close dest, leaving garbage in some strings. e.g. \"%sn\">%..." in ACDBSECTIONVIEWSTYLE.pi 2018-08-07 Reini Urban add new EMC color type for new truecolor support in entities. Also, regen-unknown fixed several wrong xdicobjhandle handles in ACDBDETAILVIEWSTYLE objects. 2018-08-07 Reini Urban unknown: work on VISUALSTYLE colors WIP actually the color.index is always 0 >= r2004. the dxf value needs to be derived from the first rbg byte somehow. 2018-08-06 Reini Urban trace CMC.flag always >=2004 a CMC always contains the index, rgb and flag. print that to detect wrong CMC colors, i.e. flags != 0,1 or 2. mingw: test too many args picat: expect also Most probable result which is at the end of definite and probable results. we don't want it to be killed before printing any result unknown: fix membits overflow found when overflowing possible and found bits. off-by-one bitsize: when setting 2 bits at 215 with 216 bits avail, it needs to set 215 and 216. so we really need to check against 217 (215+2). unknown: fix pi_fn stack overflow with path + ACDB_DYNAMICBLOCKPURGEPREVENTER_VERSION it easily exceeds 80 unknown: fix the possible/found logic set the bits from pos to the end of bitsize unknown: fix num_filled stats fixing the wrong summary count e.g. 292/281=103.9% for PDFDEFINITION 2018-08-05 Reini Urban unknown: re-add missing objects we forgot to add DECODE_UNKNOWN_BITS for TABLE* objects. just MULTILEADER is now done. unknown: harmonize object/entity format and bitsize unknown: fix HAVE_INSRCDIR check for make -C examples regen-unknown. builddir is empty, ac_builddir ditto. srcdir=. is enough unknown: check picat for Definite result otherwise keep the old log. prevents bad logs from overwriting old logs windows -Wformat: fix type REPEAT_CHKCOUNT_LVAL(name,_obj->times,type) warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'long long unsigned int' [-Wformat=] unknown: next refactor delete pre_bits, this was wrong. It starts uneven already. rather store the useful relative handle and string offsets/sizes. add ASSOCPLANESURFACEACTIONBODY to UNSTABLE similar to ASSOCDEPENDENCY 2018-08-04 Reini Urban add 2nd FIELD_CMC dxf2 arg for rgb value matching pairs 62-420, ... decode: improve color tracing work on VISUALSTYLE WIP add and set about 50% of the missing fields unknown: re-order in-work area in the spec separate UNSTABLE from DEBUGGING 2018-08-04 Reini Urban unknown: refactor 2/2 and regen-unknown now got rid of all the slack, and we can regen-unknown even with DEBUG_CLASSES. summary went from 142504/2939403=4.85% to 502764/2623166=19.17% regen added VISUALSTYLE and many other UNSTABLE classes 2018-08-04 Reini Urban move VISUALSTYLE back to UNSTABLE ~480 bits missing refactor UNKNOWN_FIELDS/DECODE_UNKNOWN_BITS dwg_decode_unknown() helper, used not only for UNKNOWN_OBJ/UNKNOWN_ENT but for all unstable classes. change to one single bits array with pre bits (if it starts not at bit 0), and num_bits (the bitsize in bits). free: fix UNKNOWN with empty dxfname on free checking an empty dxfname leads to SEGV. eg: {size = 91, address = 416360, type = 515, index = 240, fixedtype = DWG_TYPE_UNUSED, bitsize_address = 0, has_strings = 0 000, stringstream_size = 0, handlestream_size = 0, supertype = DWG_SUPERTYPE_UNKNOWN, tio = {entity = 0x0, object = 0x0, unknown = 0x0}, dxfname = 0x0, bitsize = 0, hdlpos = 0, handle = {code = 0, size = 0, value = 0}, parent = 0x7fff5fbfe0c0, common_size = 0} bypass dwg_free_variable_type for UNKNOWNs. 2018-08-04 Reini Urban add signed BLs type (420,440), fix DBCOLOR add a special int32_t BLs type just write the codes 420,440, i.e. the DBCOLOR rgb value. rename FIELD_BLh to FIELD_BLx and add more hex types. promote DBCOLOR to UNSTABLE. The remaining unknown bits are bogus, there's no CMC color field, no duplicate catalog $ name fields. Just the BLx rgb field needs to mask off the first byte for DXF, and there's a unknown RC. The DXF color index 21 is missing, this might be computed. 2018-08-03 Reini Urban unknown: more DBCOLOR work unknown DBCOLOR: split 430 name and catalog in DXF combined, in the DWG split up move DYNAMICBLOCKPURGEPREVENTER to UNSTABLE the last remaining handles were bogus, they do not exist The fiest code 70 BS looks like a class_version, but this really would be code 90. Who knows. improve UNKNOWN_{ENT,OBJ} logging to -v3 no -v5 needed anymore. regen-unknown with some changed handles. fix bit_write_RL/bit_write_BL if <0 > 255 makes not much sense. handle large negative values, detected by unknown BL node_edge1 -1 values. move LIGHT to UNSTABLE just a few unknown internal fields are remaining, but the known DXF fields are done. unknown: regen with new byte sizes and without LIGHT (see next commit). less overshoots into the next object Fix -v5 overshoot errors store the size of the common entity/object data, until the object specific fields start. for a proper UNKNOWN_*.num_bytes size. Note that bitsize does not include the size of the common handles, so we start counting at obj->address, but obj->common_size starts counting after the type, so we still overshoot by ~18 unknown: more work on LIGHT WIP fix rad2deg computation only needed for dxf and unknown unknown: skip common_entity_data for alldwg_1.inc. no such layer/color fields, which are handled in common_entity_data.spec and are not dumped into UNKNOWN_OBJ bytes at all, hindering the search 2018-08-02 Reini Urban unknown: finish UNDERLAY found remaining fields via picat/unknown, some RC/BS confusion. simplify clip_boundary and harmonize to clip_verts. move to UNSTABLE, passes all PDF coverages. but no DGN nor DWF coverage yet. 2018-08-02 Reini Urban regen-unknown unknown: skip common_entity_data there was one case of layer "0" found as TF, which was illegal unknown: regen for new Underlay_2004 rename normal/210 to extrusion for consistency unknown: work on PDFUNDERLAY WIP unknown: fix dupl. go1 target 2018-08-01 Reini Urban dwgread: declare setenv via stdlib.h 2018-08-01 Reini Urban Fix dejagnu.h linkage probe for -fgnu89-inline and use it. See https://gcc.gnu.org/bugzilla//show_bug.cgi?id=63613 Fixes [GH #2] Add dejagnu to cygwin and ubuntu/travis. msys2 dejagnu is not picked up, macos not tested on travis. 2018-08-01 Reini Urban more bit_write_RL_tests fixes this time I got all the swapping right. enhance the RL testcase using 4 different bytes dxf: implement dxf_classes_read() VALGRIND_SUPPRESSIONS: fix make dist EXTRA_DIST needs a relative pathname, Cannot stat ".//Users/rurban/Software/libredwg/valgrind-darwin.supp", note the ./ prefix testcases: oops bits_test read_RL another off-by-one dxf: more null-ptr protections check programs: use libtool with --enable-shared 2018-08-01 Reini Urban add VALGRIND_SUPPRESSIONS, check-valgrind programs integrate check-valgrind into alive.test, add more valgrind flags to check-dwg-valgrind. suppressions: on linux-glibc bash leaks like hell: GNU bash, version 4.4.23(1)-release (x86_64-pc-linux-gnu) on darwin the libc locale subsystem and objc. on the bright side: Most LibreDWG leaks are fixed. 2018-07-31 Reini Urban move MULTILEADER to UNSTABLE finish MULITLEADER >= 2010 though there are 92 bits missing before the handle stream regen-swig-patch change BITCODE_BL/RL to signed int32 harmonize all vcount/i counters and sizes to BITCODE_BL. finished MULTILEADER <2010 more MULTILEADER work WIP share ctx.content.txt and ctx.content.blk: either or. 2000 works now until end CONTEXT_DATA more MULTILEADER work WIP multiple breaks. start with 2010+ AcDbObjectContextData at the beginning more MULTILEADER work WIP actually coming closer back to the ODA specs. add back num_vertex, num_break more MULTILEADER work WIP disable to fantasy ODA structs and code. favor the DXF docs, structure and reverse-engineered data. work on MULTILEADER WIP class_version 1 has at first the LEADER_LINE{ points. fix entity picture_size BLL type lshift one too many. size used as DXF code 160. This fixes now 2010+ MULTILEADER entities, which did have a small picture attached. regen unknown added MLeader*.dwg for MULTILEADER, BoxUnion.dwg for REGION ACIS v2. removed UNSTABLE DIMASSOC, ASSOCDEPENDENCY, PERSSUBENTMANAGER. 2018-07-30 Reini Urban Improve LOG_TF trace Align the 2nd ASCII line to the left of the upper %2x hex line Improve {VECTOR,REPEAT}_CHKCOUNT macros detect buffer overflows, if AVAIL_BITS() < 0. Change AVAIL_BITS to signed long. This happens if the previous read (e.g. TF) read past the buffer parse the ACIS version 2 format It is just the unencrypted binary SAB version. Maybe I will decode it to the ASCII variant later, but it is trivial, and the binary version has higher precision. add handle stream/padding OVERSHOOT warnings log OVERSHOOT instead of MISSING when we read too far add handle stream/padding overshoots MISSING padding between the streams should be max 8. display the offset, and add MISSING if >8 separate WINEPREFIX for wine 32bit keep the default 64bit tree at ~/.wine, and create/use a new 32bit one. This test finds many useful errors. in_dxf: fix -Wnull-dereference warning 2018-07-29 Reini Urban fix --enable-debug overriding AM_CFLAGS is ignored, DEFS also. use CFLAGS. Just override -g -O2 on gcc --enable-debug, ignore -std=c99 also then. rename UNTESTED_CLASS to UNSTABLE_CLASS it really is tested, just unstable update NEWS - user-visible changes for 0.6 working on 0.6 decode: fix wrong has_strings offset fixes many skipped r2007+ strings, because of a wrong has_strings bit. Fixes [GH #34] 2018-07-29 Reini Urban decode: check obj_has_strings(type) and skip the obj_string_stream() has_strings bit check for certain fixed types which do have no strings. e.g. LINE and SEQEND entities had the has_strings bit wrongly set, they just need to be ignored. See [GH #34]. libdxfrw sets their string stream to NULL. 2018-07-28 Reini Urban remove unused duplicate reactors/xdicobjhandle They are already common object/entity fields. Remove them from the specific structs. Also remove the wrong dwg_obj_proxy_get_reactors() API, use dwg_obj_get_reactors() instead. 2018-07-28 Reini Urban MINSERT: harmonize with INSERT use SUBCLASS, better DXF layout, no attrib_handles without has_attribs unknown: more work on LIGHT got until attenuation_end_limit 2018-07-28 Reini Urban unknown: cquote C strings again log_unknown_dxf.pl already quotes " and \, but since unknown emits picat code, we need to do it again. failed only in ACDB*VIEWSTYLE template strings and MULTILEADER. 2018-07-28 Reini Urban smoke.sh: new features --enable-write is now default, cover the other new features: --disable-write, --disable-dxf, --enable-debug semver: separate patch from build number the appveyor build number goes into the generated github tag which serves as our git generated version number. 2018-07-28 Reini Urban fix DIMASSOC it has 1-4 reference points, dependent on the associativity bitmask. alloc all 4, and set only the ones which bit is set. Associativity flag [90]: 1 = First point reference 2 = Second point reference 4 = Third point reference 8 = Fourth point reference 2018-07-27 Reini Urban configure: add --enable-debug to set DEBUG_CLASSES. remove -O2 on gcc. api: sort dwg.h add api fixes perl bindings compilation errors. also add a convencience regen-swig-patch target for python. HACKING: improve examples/unknown See also https://savannah.gnu.org/forum/forum.php?forum_id=9203 testcases: fix decode_test_LDADD need to link more src objects, similar to bits_test and hash_test testcases: fix hash_test_LDADD need to link to bits and hash explicitly. needed with higher optimizations, when some smaller functions are dropped and inlined, esp. with clang >= 5. SURFACE: rename num_*data fields the size of the encrypted data. api: add missing dwg_object_to_TYPE converters Dwg_Object -> Dwg_Object_TYPE previously only for entities, now also for all objects. testcases: fix bits_test because of the bit_write_TV changes, adding the \0 to the length. alive.test: fix for --disable-dxf testcases: fix minor warnings promote DIMASSOC to UNTESTED 2018-07-26 Reini Urban add DEBUGGING DIMASSOC pretty good, just the last intsect_gsmarker: [BS 92] and the handles do look wrong in some cases. unknown: fix out-of-bounds write detected by valgrind unknown: no const struct _unknown_field unknown_dxf we write to some fields. crashes on some ELF, with this in .rodata .gitgnore: add minor files unknown: find TV len+1 A TV testvalue usually includes the final \0. Fix that in bit_write_T{VU} and unknown. We find now proper TV instead of TF values, e.g. MATERIAL.name protect ASSOCACTION VALUEOUTOFBOUNDS with DEBUG_CLASSES likewise update the docs UNTESTED, DEBUGGING, UNHANDLED, ... promote ASSOCDEPENDENCY to UNTESTED no errors in the covered examples unknown: on picat timeout try again with -g go1 currently for ACAD_TABLE.pi add DEBUGGING ASSOCDEPENDENCY looks pretty stable to me, needs a bit more testing rename SURFACE to PLANESURFACE, regen. add to API, add coverage (2004/Surface.dwg, 2018/Surface.dwg), add UNHANDLED ASSOCPLANESURFACEACTIONBODY, regen unknown. unknown: skip duplicates the same class and unknown bytes. This removed 996 entries. unknown: add 2000/Helix.dxf 2018-07-25 Reini Urban autogen.sh: clean cached VERSION swig_python.patch: redo fixing Hunk #6 succeeded at 205945 (offset 13869 lines) add -b to patch call for easier redoing the difforig. r12: fix decode_entity_preR13 call decode_entity_preR13 from dwg_add_TYPE, the promised preR13 init refactoring. r12: set more ent fields dwg_decode_TYPE calls dwg_add_TYPE, but decode_entity_preR13 needs it before and dwg_add_TYPE clears it. Need to refactor preR13 init eed: protect from empty appid->apps the handle can be empty now. repro: 2013/ground_plane_outline.dwg 2018-07-24 Reini Urban decode: don't set bitsize_address this is needed by encode DWG_ENTITY_END to write the bitsize. I hijacked it for decode DEBUGGING, but this broke dwgrewrite for example_r14.dwg dwglayers: ignore DICTIONARY as layer_control member. This has no entry_name free: fix NULL handles don't allocate illegal null handles at all, to be able to decide between global object_ref handles, and individual header var handles, and empty refs 2018-07-24 Reini Urban free: COMMON UNKNOWN_ENT also COMMON_ENTITY_DATA and COMMON_ENTITY_HANDLE_DATA, esp. pictures. e.g. frees now 7,308 bytes in 4 blocks are definitely lost in loss record 144 of 144 at 0x10016B681: malloc (vg_replace_malloc.c:302) by 0x1000056BD: bit_read_TF (bits.c:1190) by 0x10002DFF4: dwg_decode_entity (common_entity_data.spec:24) by 0x1000C45DC: dwg_decode_UNKNOWN_ENT (dwg.spec:5423) by 0x1000CF3F4: dwg_decode_add_object (decode.c:3644) by 0x100025E12: decode_R13_R2000 (decode.c:1062) by 0x100006A4C: dwg_decode (decode.c:210) by 0x100001A2F: dwg_read_file (dwg.c:186) by 0x10000118E: main (dwgread.c:213) 2018-07-24 Reini Urban free: NULL handles They were still alloced, but not globally freed, esp. in XRECORD. Fixes 8,384 bytes in 262 blocks are definitely lost in loss record 266 of 266 at 0x100165D7F: calloc (vg_replace_malloc.c:714) by 0x10002F1BC: dwg_decode_handleref_with_code (decode.c:2747) by 0x1000BEDEC: dwg_decode_XRECORD (dwg.spec:4981) by 0x1000CED60: dwg_decode_add_object (decode.c:3576) by 0x100025ADE: decode_R13_R2000 (decode.c:1062) by 0x100006718: dwg_decode (decode.c:210) by 0x1000016FB: dwg_read_file (dwg.c:186) by 0x100000E5A: main (dwgread.c:213) 2018-07-24 Reini Urban add UNDERLAYDEFINITION, DEBUGGING UNDERLAY UNDERLAYDEFINITION seems to be ok, UNDERLAY still a hole before flag 280 and no Boundary coverage yet. 2018-07-23 Reini Urban add DEBUGGING *SURFACE entities HATCH: is now stable Closes [GH #27] free: improve eed double-free Fixes [GH #33], detected by jinyu00 2018-07-22 Reini Urban unknown: log_unknown_dxf use different comment style for easier unknown.sh helper script to detect all classes. unknown: write fieldnames into pi add DEBUGGING ASSOCALIGNEDDIMACTIONBODY some logic is still missing when to skip some fields add DEBUGGING DYNAMICBLOCKPURGEPREVENTER fields ok, just after the last handle is an unknown 47bit hole 2018-07-22 Reini Urban add --disable-dxf Disable DXF and other in/out modules, and most helper programs, only dwgread. Only useful for faster test/debug cycles. 2018-07-22 Reini Urban unknown: more DBCOLOR got now the name and color catalog (guide) after a hole of 24bits. but there are still 2 big holes. add PERSSUBENTMANAGER to UNTESTED very low coverage and no known fieldnames. but the dxf groups do look stable 2018-07-21 Reini Urban unknown: finished fieldnames unknown: ignore alldwg.skip this is stderr from unknown. all classes have now enough information disable regen-unknown with !HAVE_INSRCDIR Need a configure in srcdir. Fixes distcheck errors, and enables proper deps unknown: add fieldnames and fix some found dxfgroup errors and missing fields 2018-07-21 Reini Urban unknown: various improvements use the handle code, not just value. print the found/notfound fields better. print more picat statistics: Found, NotFound ratio, Missing bits. add Class,Dxf,Version to the picat data for better constraints checks. improve SUN spec 2018-07-20 Reini Urban protect dwg_obj_block_control_get_block_headers from empty ctrl->block_headers. Fixes [GH #32] add DEBUGGING ASSOC2DCONSTRAINTGROUP partially, up to AcConstrainedImplicitPoint. no names found yet 2018-07-20 Reini Urban add picat step to make unknown Only done when picat was found in the path by configure. Get picat binary or source packages from picat-lang.org To skip or override timeout use make unknown TIMEOUT_30= timeout is from coreutils. https://www.gnu.org/software/coreutils/manual/html_node/timeout-invocation.html add a basic description to HACKING 2018-07-20 Reini Urban regen-unknown catch all the new classes. unknown summary: 478284/2967120=16.12% add more unhandled classes to the header and classes.inc 2018-07-19 Reini Urban unknown: more EVALUATION_GRAPH fixes but still some unclear options gitignore: ignore generated picat files .qi is a compiled .pi add DEBUGGING ASSOCPERSSUBENTMANAGER picat laid out the fields wonderfully, just the names are now missing configure: probe for picat and add more PROG versions to config.log unknown: sort alldwg.inc new summary: 108570/1028945=10.55% much less skips 2018-07-19 Reini Urban unknown: better BIT bugfix finally we are finding the strings we should be finding all along. we still need to sort alldwg.inc by class. cannot tell the new summary yet, as it is crashing with overwriting some malloc's, but overall it looks significantly better, between 30-40% for many: unknown-ACAD_EVALUATION_GRAPH.log:summary: 216/1206=17.91% unknown-ACAD_TABLE.log:summary: 272708/1157653=23.56% unknown-ACDBASSOC2DCONSTRAINTGROUP.log:summary: 5084/46715=10.88% unknown-ACDBASSOCACTION-work.log:summary: 0/193=0.00% unknown-ACDBASSOCACTION.log:summary: 400/717=55.79% unknown-ACDBASSOCALIGNEDDIMACTIONBODY.log:summary: 282/571=49.39% unknown-ACDBASSOCDEPENDENCY.log:summary: 256/571=44.83% unknown-ACDBASSOCGEOMDEPENDENCY.log:summary: 4648/11862=39.18% unknown-ACDBASSOCNETWORK.log:summary: 1824/3274=55.71% unknown-ACDBASSOCOSNAPPOINTREFACTIONPARAM.log:summary: 508/1043=48.71% unknown-ACDBASSOCPERSSUBENTMANAGER.log:summary: 732/3457=21.17% unknown-ACDBASSOCVERTEXACTIONPARAM.log:summary: 612/1307=46.82% unknown-ACDBDETAILVIEWSTYLE.log:summary: 13994/138466=10.11% unknown-ACDBPERSSUBENTMANAGER.log:summary: 40/743=5.38% unknown-ACDBSECTIONVIEWSTYLE.log:summary: 28194/230930=12.21% unknown-ACDB_LEADEROBJECTCONTEXTDATA_CLASS.log:summary: 1624/3443=47.17% unknown-ACSH_HISTORY_CLASS.log:summary: 216/368=58.70% unknown-ACSH_SWEEP_CLASS.log:summary: 1160/10634=10.91% unknown-ARC_DIMENSION.log:summary: 31376/104047=30.16% unknown-CSACDOCUMENTOPTIONS.log:summary: 0/6160=0.00% unknown-DBCOLOR.log:summary: 400/39784=1.01% unknown-DIMASSOC.log:summary: 6036/42548=14.19% unknown-HELIX.log:summary: 33820/89830=37.65% unknown-LAYOUTPRINTCONFIG.log:summary: 0/1930=0.00% unknown-LIGHT.log:summary: 1642/9020=18.20% unknown-MATERIAL.log:summary: 21090/276592=7.62% unknown-MULTILEADER.log:summary: 20682/90631=22.82% unknown-SUN.log:summary: 630/2804=22.47% unknown-TABLECONTENT.log:summary: 11160/226312=4.93% unknown-TABLEGEOMETRY.log:summary: 0/0=nan% unknown-TABLESTYLE.log:summary: 14416/427123=3.38% 2018-07-19 Reini Urban unknown.pi: add hole detection for the next solver step, to add the leftover fields rests to the holes. and to fill in likely dwg-only fields, not in the dxf. unknown: shorted HANDLE to H structname unknown: whitespace only indent class - dxf loop 2018-07-19 Reini Urban unknown: create picat data files process unknowns per class, not per file anymore. change bit_errprint_bits to bit_fprint_bits, without \n. TODO: pre-sort alldwg.inc per class. 2018-07-19 Reini Urban unknown: picat module and EVALUATION_GRAPH data for the picat solver helper to layout unknown fields. there's no backtracking with constraints, there's not enough data yet. 2018-07-17 Reini Urban bits: add bit_errprint_bits print bits to stderr, not stdout fix EVALUATION_GRAPH Object bugs the fixed unknown revealed some type errors 2018-07-16 Reini Urban unknown: fix BIT bug 10 is the proper representation of BL/BS 0, not 00. (gdb) p/t 0x80 => 10000000 summary: 200166/2972461=6.73% 2018-07-15 Reini Urban add DEBUGGING ASSOCOSNAPPOINTREFACTIONPARAM Object half-way through 2018-07-15 Reini Urban unknown: fix overlap check skip the last bit+1. and mark as found if num_found == num_dxf, even for >5 213008/2972461=7.17% 2018-07-15 Reini Urban unknown: reformat output put bits into col 0 print each dxf fields at col 0 put search into one line add num of same DXF fields to result add + or ? to found 172488/2972461=5.80% 2018-07-15 Reini Urban unknown: skip duplicate handle codes and skip searching for EED dxf codes, they are not stored in the unknown bytes, and are not stored dupl. as DWG fields 2018-07-15 Reini Urban refactor DEBUG_HERE needed to print the object offset, add DEBUG_HERE_OBJ, DEBUG_POS_OBJ note that UNKNOWN_* excludes the EED and common_entity_data flip two SUN fields 2018-07-15 Reini Urban more DEBUGGING SUN work stability: protect print loops we bail out earlier now in REPEAT and VECTOR leaving the field unallocated. Protect against that in print at least. add DEBUGGING EVALUATION_GRAPH Object in_dxf: no inline dxf_free_pair -Winline warned: call is unlikely and code size would grow 2018-07-14 Reini Urban unknown: compile-time multiple matching fields pre-calculate the number of potential same DXF fields values, same basic type and same string value. No need to calc num_dxf() at run-time back to the previous 172968/2972461=5.82% 2018-07-14 Reini Urban unknown: handle multiple matching fields when the same DXF value could lead to the same binary representation. e.g. DBCOLOR has 2 equiv. DXF fields 330:handle, or mult. 90:"21" fields. mark them as found also. check raw numeric types also, if the bitencoded one failed. advanced to 172692/2440879=7.07% and found several unique hits in previously skipped classes 2018-07-14 Reini Urban unknown: fixup DBCOLOR status it is DEBUGGING add .c.ii rule for preprocessed files without line markers. useful for debugging macros. stability: more isnan checks logs: add GNU parallel usage This is of course massively parallel and faster. See https://savannah.gnu.org/forum/forum.php?forum_id=9197 2018-07-13 Reini Urban unknown: skip empty objects unknown prints all empty objects with 0.0% found to alldwg.skip which will be subsequently skipped unknown: skip some duplicates and 0% egrep '0.0%|test/test-data/' unknown-0.5.1027-12-g28982958.log | grep -B1 0.0% unknown: regen with DBCOLOR fix regen-unknown to include more unknowns, esp. DBCOLOR stability: improve REPEAT_CHKCOUNT but via sizeof, not minimal bits_size. abort HATCH with gradient fill on print WIP dbcolor handle See [GH #31] Untested OBJECT DBCOLOR referenced by color handle of some entities WIP See 2004/CascoUrbano GH #27 fix SORTENTSTABLE 2018-07-13 Reini Urban stability: improve VECTOR_CHKCOUNT add global dwg_bits_size: minimal sizes of all types and check each VECTOR or REPEAT before the malloc against overflow. move dwg_bits_name from unknown to common.{c,h} 2018-07-13 Reini Urban free: protect empty FIELD_VECTOR_N check-syntax: add nice -O0 unknown flycheck lasts too long ASSOCNETWORK: demote back to DEBUGGING inline the actions, WIP. But coming very close. unknown: log pos range from-last bits handle relative codes 6-c relative offset handles do have an ref, even with size 0. esp. code 6 (next) and 8 (prev). autogen.sh: generate .tarball-version this is done by dist-hook, but we are doing some extra work to be clearer 2018-07-12 Reini Urban examples: wrong EXTRA_DIST we don't need to distribute the unknown sources unknown: promote ASSOCNETWORK to UNTESTED the action handles are missing, but it looks rather good and stable unknown: fix relative c handle -3 offset is stored as c.1.3 unknown: support relative reactors from 150616 to 150760 2018-07-12 Reini Urban unknown: fix relative handle offsets 6.0.0 is +1, 8.0.0 is -1 a.0.1 is +1, ... from 150560 to 150616/2490950=6.05% 2018-07-12 Reini Urban unknown: more ASSOCACTION work compilation fixes with -DDEBUG_CLASSES dwg2dxf: free only with mult. infiles unknown: fix imprecise RD search we added a RD step after BD, changing the type to RD. improved from 147660/2490950=5.93% to 150560/2490950=6.04% unknown: add --class filter, unknown.sh filter by classes. add the dxf to the header. fix the TU is16 flag for r2010+ free the temp. chains (to reuse the buffers), our data-structures got bigger over time. 2018-07-12 Reini Urban unknown: regen and fix some warnings generated a lot of matching DXF's to find more fields. new summary: 147594/2490950=5.93% prev. 4810/407639=1.18%, 8384/548025=1.53% 2018-07-12 Reini Urban unknown: fix restarts, esp. r2010+ the offset calculation was wrong, leading to wrong unknown bytes being logged and analyzed for r2010+ 2018-07-11 Reini Urban fix git-version-gen for tag releases on a tag commit `git describe HEAD` cannot find a description, use --tags to avoid an UNKNOWN version, and use the tag. dxf: add HEADER_TU LASTSAVEDBY and fix a couple of compiler warnings of unused functions configure: print generated git version perl: fix bash syntax error syntax error near unexpected token `;' dwg2dxf: fix -Wuninitialized though practically not happening configure: honor system CFLAGS and AC_SUBST(WARN_CFLAGS) is already done by AX_COMPILER_FLAGS 2018-07-11 Reini Urban re-enable WARN_CFLAGS was disabled when AM_CFLAGS was set in *.am and configure.ac fix various minor warnings: -Wshadow, -Wsign-compare, missing-decls undefine DEBUGGING_CLASS'es in the spec (-Wunused-function) 2018-07-11 Reini Urban win32 static: check ENABLE_SHARED some libtool cannot build shared, but __declspec(dllimport) is still set there, leading to linker errors. the same happens on windows with --disable-shared. python: stabilize help with empty PYTHON. don't make check without python in xmlsuite perl: skip make with windows Makefile with incompatible command.com/cmd.exe shell grep for NOOP = rem and skip then. This bug started with the msys update to perl-5.28 Before the Makefile was properly created from bash for bash. perl: fix OBJEXT perl: prefer local dwg.h over old installed see GH #29. Also disable the unused cmdline overrides unknown: add CMC support for DXF 63 only for indexed color values unknown: regen alldwg.inc add more dxf counter-parts, fixed dxf field in alldwg.inc. work on MULTILEADER 3BD ctx.content_base -> 3RD at offset 384-576 with example_2000.dwg rename leaderstyle 340 handle to mleaderstyle summary: 8216/544344=1.51% 2018-07-09 Reini Urban patch: add build-aux/swig_python.patch to EXTRA_DIST failed in distcheck add unknown make target 2018-07-08 Reini Urban unknown: try BS-BL, and BL-BS from 4720 to 4810 unknown: try RD when BD failed from 2718 to 4720 (precise only, unprecise added no hits) 2018-07-08 Reini Urban unknown: restrict relative handles only some code 6 and 8 offsethandles are valid, only of the new handle has an +1 or -1 offset. ditto for a and c: the offset must be positive. down to 2718 2018-07-08 Reini Urban unknown: add OFFSETOBJHANDLE code>5 variants relative (shorter) handle values. yet unsuccessful. removed one wrong found handle c: down to 2734 unknown: try RC for BS and vice versa from 2742 to 2782 2018-07-08 Reini Urban unknown: fix printing found BD print the BD bitmask at the found offset and compare it the DXF string (should be <0.001). down from 3270 to 3252 bits, and with a crosscheck for <0.001 even down to 2742. 2018-07-08 Reini Urban unknown: more unprecise BD search still 3270 bits found unknown: add unprecise BD search cut the mantissa precision from 52 bit to 44 bit. finds now 23 more BD's, e.g. 10.0, 50.0, 2231.000092348011, -54.05474532926735, 490.6216519543077, 20.75891407303142 unknown: try TV if TU fails (unsuccessful) add summary stats common: explain the MC0.0 magic http://www.fourmilab.ch/autofile/www/section2_11_4.html http://www.fourmilab.ch/autofile/www/chapter2_14.html 2018-07-07 Reini Urban unknown: add coverage stats store each found and possibly bit, to continue search if already reserved, and get some picture 2018-07-06 Reini Urban unknown: try more handle codes now found 62 unique handles, improved from 140 to 151 found 1. stats of found fields: 1 151 2 118 3 37 4 20 5 93 >5 11692 2018-07-06 Reini Urban unknown: improve handle codes now found 51 unique handles, improved from 94 to 140 found 1 2018-07-06 Reini Urban unknown: fix bits_BS strtol using sscanf is always a bad idea. The data looks pretty good and solvable now. stats of found fields: 1 94 2 109 3 34 4 17 5 101 >5 11678 2018-07-06 Reini Urban unknown: store max 5 found positions stats of found fields: 1 94 2 109 3 34 4 14 5 101 >5 11678 unknown: fix alldxf_1.inc extended fields add the missing fields. use -1 for not-found pos, not 0. This enables the first field being at first. 2018-07-06 Reini Urban unknown: implement membits use our own search, which is much easier than handling all the memmem corner-cases at the beginning and end, and bit-shifting. use strtod instead of sscanf %lf. was buggy. print the bits to review the search (and check write API, looks wrong), added bit_print_bits to bits.c WIP: The doubles BB prefix looks wrong, the double values from strtod also. maybe hardcode some string->double conversions. 2018-07-06 Reini Urban unknown: add TV and angle_BD types non-unicode for 300-309, deg2rad angles for DXF 50 types unknown: fix DXF 310 hexstring and fix wrong dxf_size vs dxf_bitsize. add dwg_bits_name[] document libredwg.pc 2018-07-05 Reini Urban add libredwg.pc unknown: fix search_bits convert the bytes/bits to one byte stream. add carry logic and remaining dxf->bits 2018-07-05 Reini Urban unknown: search_bits search for the binary repr in the stream and store found position if found only once. try for all 8 possible shift positions. TODO: we don't handle multiple findings yet, and we didn't find any unique pos yet. the carry logic and the remaining dxf->bits are also missing. 2018-07-05 Reini Urban unknown: store the binary repr - bits_format for each dxf value 2018-07-05 Reini Urban unknown: split up generation of static array of struct we need 3 parts to be able to initialize it statically. disable alldwg.inc for now. we don't need to find the fields order and pos, only for a consistency crosscheck against all DWG's without matching DXF afterwards. add 2 fields to the dxf fields: type and pos, resolved by the solver. 2018-07-05 Reini Urban unknown: never build alldwg.inc unless via regen-unknown. generated sources are in builddir, only from there ./logs.sh can be run. 2018-07-05 Reini Urban unknown: implemented log_unknown_dxf.pl created now alldxf.inc with all the real dxf values to find in the unknown bits. DEBUGGING_CLASSES ASSOCACTION, ASSOCNETWORK add build-aux/swig_python.patch for a warnings free swig source, for swig 3.0.12 regen-man: with version 0.5.1-dev dwg2svg2: use getopt_long dwg2ps: use getopt_long dwgbmp: use getopt_long dwg2SVG: use getopt_long dwggrep: use getopt_long dwglayers: use getopt_long dxf2dwg: use getopt_long dwg2dxf: use getopt_long change -as-rNNNN to --as rNNNN resp. -a rNNNN. dwgrewrite: use getopt_long change -as-rNNNN to --as rNNNN resp. -a rNNNN. dwgwrite: use getopt_long change -as-rNNNN to --as rNNNN resp. -a rNNNN. dwgread: without HAVE_GETOPT_LONG dwgread: use getopt_long which is a bit broken for -v3 (optional args), but we hack around it. at least we can use all options in any order now. stability: no endless loop with small files dwgs are normally >1000byte. But with a wrong filename avoid an endless hash_new loop with size==0 (/1000) Doxyfile: only with doxygen fix distcheck uninstall for perl and doc the added to perllocal.pod and share/info/dir cannot be uninstalled. 2018-07-05 Reini Urban First release 0.5 2018-07-04 Reini Urban logging: remove decimal handle value handles are hex only 2018-07-03 Reini Urban dxf: protect empty vectors and fix wrong MATERIAL text types for *map_filename api: remove wrong comment MULTILEADER spec: more DXF and return earlier on errors 2018-06-30 Reini Urban Third test release 0.4.938 2018-06-29 Reini Urban more format string types enable glibc strcasestr probed as yes, but not declared. same as on darwin. ../../programs/dwggrep.c:213:7: warning: implicit declaration of function ‘strcasestr’ [-Wimplicit-function-declaration] if (strcasestr(text, pattern)) 2018-06-29 Reini Urban alldwg.inc: create from builddir ./logs.sh can only be run from the builddir, only there are the binaries. call make from logs.sh, not gmake. we would really need a MAKE=$(MAKE) but this is only done on regen-unknown by the maintainer. make the alldwg.inc target a maintainer rule only. test -d ../.git || false 2018-06-28 Reini Urban eed: fix max limit from 1024 to obj->size And on overlong stringsize just skip it to the end. This fixes the error with hatch_color_ref.dwg from [GH #27] and several LAYER entities with attached large EED data. 2018-06-28 Reini Urban Second test release 0.4.924 2018-06-28 Reini Urban common_entity_data: fix has_ds_binary_data use instead of nolinks with r2013+ improve FIELD_2DD_VECTOR logging, print index 2018-06-28 Reini Urban try ACIS 2 only with .git (ifndef IS_RELEASE) add some FIELD formatting overrides FIELD_RCu lineweight FIELD_BLh rgb_color pass thru preR13 decode errors add analog VECTOR_CHKCOUNT also for HATCH. Maybe we should use these checks only for known UNKNOWN_CLASS entities. The strcmp check for the classname is resolved at compile-time already., if the classname would appear in the macro. add REPEAT_CHKCOUNT and use it more not only since r2010+ also with r2004 for invalid HATCH entities. decode BD stability: check bit_isnan when decoding bitcode encoded doubles, check for our own unique return value of bit_nan (avoiding math.h and -lm). return DWG_ERR_VALUEOUTOFBOUNDS in objects and entities then 2018-06-28 Reini Urban fix common_entity color ENC encoding various serious errors in the color encoding for entities, called ENC. The bug only occurred with non-indexed colors with RGB or transparency values. Thanks to @arturredzko for an example DWG. 2018-06-28 Reini Urban api: finish docs, more renames Take the opportunity that the API should be somewhat sane and stable, to harmonize more names: align => alignment numrows => num_rows numcols => num_cols flags_ => flag remove the dwg_ent_insert scale_flag API. This is DWG internal only. 2018-06-27 Reini Urban ChangeLog: update for last month with gnulib's gitlog-to-changelog, clustered. cluster adjacent commit messages if their headers are the same and neither commit message contains multiple paragraphs. 2018-06-27 Reini Urban python DISTCLEANFILES portability: fix GNU make extensions hard-code all our test-data files test/Makefile.am:16: warning: :=-style assignments are not portable test/Makefile.am:16: warning: shell git ls-tree -r --name-only @ test-data: non-POSIX variable name test/Makefile.am:16: (probably a GNU make extension) stability: 2004 section map the extremely large HARTA_E_PRISHTINES_2004 dwg has an odd last AcDb:AcDbObjects section, which is misinterpreted as new section info, not the last section. It also misses now several section types. Only the 2007 variant decodes fine. All 2004 (r2010+) versions not. dwggrep: finish object fields add all known missing test fields. now only the TABLE name matcher is not yet implemented. FIELD: fix ODA bug value_string_length is of type BL, not T automake HAVE_PYTHON check skip test/xmlsuite with --disable-python 2018-06-26 Reini Urban alive.test: add example_r14.dwg This is also a supported version fix automake HAVE_LIBPS ac_cv_header_libps_pslib_h is set later, by AC_CHECK_HEADERS. programs/dwg2ps was never generated 2018-06-25 Reini Urban First test release 0.4.900 2018-06-25 Reini Urban api: add dwg_block_control, dwg_{model,paper}_space_ref dwg_block_control is easy, always the first object, and also dwg->block_control. but the canonical model and paper space headers are a bit tricky to get to iterate over it. fix the implementations and docs, and use the new API. the old api via dwg_obj_block_control_get_model_space from the block_control was awful and wrong. 2018-06-24 Reini Urban dwggrep: fix BLOCK_HEADER for r2010+r2013 with r2010+r2013 the block_control.model_space is different from the original BLOCK_RECORD_MSPACE. We rather prefer 1F, the one from the header. Many entities went missing there. TODO: Fix the API iterators and docs, how to iterate over all entities. 2018-06-24 Reini Urban dwggrep: add pcre2 to appveyor dwggrep: fixup documentation dwggrep: extract print_match calling a func is faster than inlining it. less cache bloat. remove unneeded re_prepare, no .* embedding needed. const and restrict the args 2018-06-24 Reini Urban dwggrep: fix the jit, enable --type, --dxf PCRE2_PARTIAL_* needs a compiled index [1] or [2] re function, but we compiled only a simple (fast) matcher, so the jit always returned PCRE2_ERROR_JIT_BADOPTION. i.e. the compile options must match the match options. also enable the --type and --dxf option. for --type we need to set obj->dxfname globally for each object to a const string, no threat. 2018-06-24 Reini Urban dwggrep: add native pcre2-16 support no need to convert r2007+ strings to UTF-8, match them directly with the pcre2-16 matcher But the JIT matcher is still broken, never worked. substring search works fine though. 2018-06-23 Reini Urban dwggrep: more entities and features and fix strcasestr dwggrep: more robust probes and fallbacks no regex support when pcre2 is not available. (no gnu regexp, sorry) fix the configure probes, add my strcasestr fallback add dwggrep try pcre2 jit, and then simple substring matching. not handling prec2-16/r2007+ texts yet. doc: texi updates and fixes perl: remove generated swig files they can be easily generated. it was useful to see API changes though 2018-06-23 Reini Urban python: case-sensitive LibreDWG name renamed from libredwg. We've put the module name for consistency into the dwg.i I have no idea if the binary can stay lower-case, or needs to have the same name, but the comment seems to mandate the same case, just a prepended _ 2018-06-23 Reini Urban distcheck: dwg2ps.1 oddity now install it, even if the binary might be not built distcheck: *.1 are generated in srcdir for a while already python: fix libredwg.py distcheck Both swig-generated files are put into srcdir, not builddir with swig-3. With swig-2 I think they are in builddir, as seen on travis. We need at least the .py in builddir. perl: add needed deps to compile perl XS packages. cygwin: libcrypt-devel perl: no install req, try LD_RUN_PATH= and fix the path to src/.libs from srcdir to builddir 2018-06-22 Reini Urban skip check perl when the shared libredwg is not installed. It is too problematic to link to the uninstalled so: linux, osx, windows doc: add Bindings chapter TODO: update 2018-06-22 Reini Urban configure: allow PERL, check --disable-python allow overriding PERL=cperl5.26.1 e.g. for using ccache. allow swig bindings for perl when python is disabled, because we ship the generated swig_perl.c I really need to cache cperl and it's used ccache compiler, to be able to use ccache in the perl binding. remove bindings/perl/Makefile.in generation. forgot that earlier. 2018-06-22 Reini Urban rename swig_wrap_* to swig_*.c harmonize the generated swig wrapper names. and improve the perl flags a bit. 2018-06-22 Reini Urban add perl bindings WIP 2018-06-22 Reini Urban swig: smaller API we don't need duplicate struct accessors generated by swig for all the struct fields and via functions. strip the functions. also avoid the duplicate API types, only use the dwg.h types. bindings/dwg.i | 169 +- bindings/perl/LibreDWG.pm | 1031 +- bindings/perl/swig_perl.c | 40775 ++-------------------------------------------------------------- src/dwg_api.c | 2 +- 4 files changed, 1185 insertions(+), 40792 deletions(-) bindings/dwg.i | 169 +- 2018-06-22 Reini Urban fix swig bindings do not use -importall, rather include our 2 headers manually. once verbatim and once via %include. 2018-06-22 Reini Urban api: cleanup by checking the perl swig bindings fix _3DSOLID and a couple more undefined classes, only detected by the new perl binding. add many missing dwg_ent_ field functions and many other typos or renames. add missing variable entity getters we can now check fixedtype add missing dwg_obj_obj methods and more missing or wrong obj methods 2018-06-22 Reini Urban api: ref, object rename, harmonization rename several API funcs for proper prefixes. Dwg_Object* methods are using the dwg_object_ prefix, Dwg_Object_Ref* getters use dwg_ref_get_ dwg_api: dwg_obj_polyline_*get_*points(Dwg_Object*) => dwg_object_polyline_* dwg_obj_get_*(Dwg_Object*) => dwg_object_get_* dwg_obj_object_get_index(Dwg_Object*) => dwg_object_get_index dwg_obj_ref_get_object(Dwg_Object_Ref*) => dwg_ref_get_object dwg_get_type => dwg_object_get_type dwg_get_dxfname => dwg_object_get_dxfname Add the dwg_object_get_fixedtype API. And then rename two uncommon signatures taking Dwg_Object_Ref*. dwg.h: dwg_ref_get_object(const Dwg_Data *restrict dwg, Dwg_Object_Ref *restrict ref) => dwg_ref_object which clashed with dwg_ref_get_object taking a Dwg_Object_Ref*, which was before named dwg_obj_ref_get_object. dwg_ref_get_object_relative(const Dwg_Data *restrict dwg, Dwg_Object_Ref *restrict ref, const Dwg_Object *restrict obj) => dwg_ref_object_relative (also unused) 2018-06-22 Reini Urban add a Windows paragraph to README unknown: add dxf, replace offset with handle this is also unique and can identify the object in the matching DXF. so we can actually match the proper values and types. more regen alldwg.inc fixes alive.test: print the failing log check-dxf: fix, and add r14 the second loop was broken unknown: skip regen alldwg.inc add a special regen-unknown target to generate alldwg.inc add missing DIST declarations: logs.sh, alldwg.inc (which triggered the generation on distcheck, an out-of-dir configure) forgot to EXPORT dwg_absref_get_object the fixes SWIG bindings for perl found that out. 2018-06-21 Reini Urban add examples/unknown a sample program to find the most likely fields for all unknown dwg entities and objects. gather all binary raw data from all unknown dwg entities and objects into examples/alldwg.inc. with the available likely fields try permutations of most likely types. 2018-06-21 Reini Urban bump DWG_ERR_CRITICAL to CLASSESNOTFOUND i.e. VALUEOUTOFBOUNDS will not stop processing DWGs and will not report the process as failed. error: add 2004,2007 realloc -1 error propagation pass back proper error status bits, esp. on r2004 + r2007. ignore a return val of -1 for realloced obj's. Now most DWG return 0. Some exotic ones still crash though: Helix and r11. more diagnostics print more read values, and skip duplicates earlier read decode: no duplicate xdic_missing_flag logging r11: check empty object->hdl 2018-06-21 Reini Urban better HANDLE diagnostics try to accept new code 0xe (REGION.history_id r2007+), print codes in hex. print failing/invalid handles inline dwg_decode_handleref into dwg_decode_handleref_with_code to get the original wanted code pointer type. 2018-06-21 Reini Urban print: harmonize HANDLE printing We log TF and TFF values with -v5 just add the field name and type 2018-06-21 Reini Urban start with ACIS/SAT version 2 which is most likely a 5 byte link to a blob of their fork of ACIS 7.0 called now ShapeManager, with all the versions. But all the different ACIS data has in version 2 the same content: 5: BL + 0d254c8109 + 0: BL, so there must be something else. There is EED data attached to it, with 0-2 handles and several code 70 and one 71. The handles are to APPID instances: ACAD_OBJECT_CHANGE_GUID and ACAD_STEPID. 2018-06-20 Reini Urban stability fix a few dead stores, fix a dwg2SVG INSERT problem, propagate more errors back. free: a few more minor leaks dxfname leak: typically 2Kb eed: also about 2Kb free: fix the str_dat leak typically 20Kb free: remove dwg_free_handleref just free the ref, and handle the dwg->object_ref[] later. re-enable dwg->object_ref[] to catch all dwg_decode_handleref refs. free: fix dwg->object_ref this is one array. skip the linear seearch in dwg_free_handleref, just free the ref, the array is free'd later at once. free the classes later, they are need to dispatch var-types. free: call hash_free 7KB typically free: enable free for num_objects < 1000 to catch regressions. Performance is only a problem for big DWGs. dwglayers accidentally always used dwg_free. improve dwg_free_handleref free: improve dwg_free_eed handle data, raw and eed uniformly silence dwglayers handle errors check decompress_R2004_section errors change all object indices to BITCODE_BL (2/2) forgot some change all object indices to BITCODE_BL to match the actual serialized data type. long is way to large on 64bit. rename idc variables to index and i. in encode and decode encode: fix critical object_map index bug we mixed up index with handle, leading to an object overflow. encode: add and fix dwg_encode_eed wrong size, leading to subsequent overflows. add #ifndef IS_RELEASE VECTOR overflow checks in encode 2018-06-19 Reini Urban disable TABLE again fails even with r2000-r2007, but not much missing. free: fix TABLE subclassing check for wrong type encode: harmonize EED loop there's no dwg_encode_eed() (yet), but at least harmonize both code paths. Writing the entity EED is still broken WIP. 2018-06-19 Reini Urban encode: fix bit_chain_alloc There is one overlarge XRECORD, size 53014 > CHAIN_BLOCK (40960). When adding this object to dat, it overflowed the Bit_Chain heap. Also remove the superflouos DWG_SUPERTYPE_UNKNOWN logic from the encoder, rather do this in classes.inc 2018-06-19 Reini Urban harmonize test-data Constraints_*.dwg file names Strip the version suffix, which is already defined by the dir. This avoids x_2004_2004.log and dxf files also. add common_entity_data.spec leave with DWG_ERR_VALUEOUTOFBOUNDS early on wrong class_versions, which are usually 0-2 2018-06-19 Reini Urban add 3BLL type as documented, enable TABLE <= r2007 BLL uses 3 bits for len, but it is documented to use 3B: 1-3 bits stopping at the first 0 bit. Which would leave us with 0: 0, 10: 2, 110: 6, 111: 7. 100 for 4 or 101 for 5 would be invalid. But this documentation is wrong, this encoding is not used for REQUIREDVERSIONS, picture_size. Add the unused documented variant as 3BLL type. Use the old TABLE pre-2010 as STABLE, and as DEBUGGING since r2010+. dxf: Use the entity dxfname for variable types: ACAD_TABLE. Fixes some entities for the picture_size. Trace more common entity data. 2018-06-19 Reini Urban refactor: add ACTION, TABLE: call TABLECONTENT Now we separated the initializer from the field handler. Enable experimental TABLE r2010+ support, by allowing calling the sublassed TABLECONTENT decoder, from within TABLE. All modules define now its ACTION globally for dwg.spec and classes.inc 2018-06-18 Reini Urban api: fix the public dwg_add_* decls checked against classes.inc and its DEBUG_CLASSES setting 2018-06-18 Reini Urban api: separate dwg_decode_OBJECT and dwg_add_OBJECT dwg_decode_OBJECT calls now dwg_add_OBJECT, but dwg_add_OBJECT can be called separately, for the import modules. There's also a new realloced = dwg_add_object(dwg); API. Adjust the docs. See [GH #19] 2018-06-18 Reini Urban smoke.sh: remove arm workarounds arm cross can compile now src/out_dxf properly docs: update status add unhandled LAYOUTPRINTCONFIG class but only found the class, no object instance yet. 2018-06-18 Reini Urban dwg2svg2: simplify API usage searching for the block_header is pretty stupid. we need to get the main block_control globally (its always the first object), and from this we get its mspace and pspace headers. Some DWGs replaced their tables with dictionaries, and there the headers will not be found this way. 2018-06-18 Reini Urban dxf: protect from empty ENT_REACTORS REGION on example_2013 has num_reactors 1 but no attached reactor. This could happen on a missing handleref object 2018-06-18 Reini Urban disable TABLE entity With r2010+ a TABLE needs to jump to the TABLECONTENT object, but without the initialization, just the fields. we really need to split up DWG_OBJECT into init and fields methods, see also [GH #19] where we want to split it up into action_OBJECT for the fields and add_OBJECT. 2018-06-18 Reini Urban add better example DWG and DXF for test coverage Convert the better example_*.* coverage test file to all versions. Adjust the coverage TODO report. 2018-06-18 Reini Urban dxf: extend 2018/example_2018 added a couple of missing objects/entities. extend classes.inc and DWG_TYPE_ for these. Check for invalid TABLE.num_rows (with this 2018 TABLE) and mark it UNSTABLE. DXFIN import of the converted dxf fails with "Xdata wasn't read" 2018-06-17 Reini Urban dxf: add dxf_3dsolid WIP print the encrypted 1/3 strings. dxf: fix GROUP parenthandle 330 as AcDbEntity not in the AcDbGroup subclass dxf: fix STYLE flags, IMAGE add two missing STYLE bits, fix IMAGE group 23, 340, 360 fix WIPEOUT group 340, 360 add dxf test scripts dxf: handle DIMENSION_ sub objects fix dxf groups of ins_scale 41-43 fix subclass markers dwg2dxf: no dxf write on critical dwg read error but continue to next input file dxf: fix SOLID/AcDbTrace subclass marker and the pts groups: 10-13, not 11-14 api: some more NULL ptr protections dwg_next_object, dwg_ref_get_object dxf: fix ATTRIB,INSERT subclasses dxf: fix ATTDEF subclass dxf: fix REGION subclass 2018-06-17 Reini Urban fix SPLINE r2013+ with splineflags1 & 1 the scenario flips to 2 fixes example_2018 add -lm dependency to avoid writing nan values into DXF. rather skip wrong values then. add SPLINE flag DXF 70 support 2018-06-17 Reini Urban dxf: SUBCLASS (AcDbText) also for r2018+ dxf: harmonize dxfb with dxf add all the recent dxf improvements, dxf: write 5 handle since r11, not r2000+. removed unused COMMON_TABLE_CONTROL_FLAGS macro args suffix.inc: more strdup decl some linux libc still complains about lack of a strdup decl. dxf: fix asan overflow global-buffer-overflow, harmless but asan treats it as fatal api: fix Undefined allocation of 0 bytes scan-build complains about CERT MEM04-C; CWE-131 fix various scan-build warnings initialize *src at decompress_r2007, help hash struct _hashbucket vs 2*uint32_t confusion dxf: typo DIMFXLON is B not BD 2018-06-16 Reini Urban dxf: fix AcDb3dPolylineVertex add subclass markers, fix the 0 entity names put the flag behind the point. but acad crashes on import AcDb3dPolylineVertex 2018-06-16 Reini Urban dxf: fix LWPOLYLINE closed flag interestingly the flag 70 needs to be after the num_points 90 to have an effect at the closed flag 70 & 1. with 90 after 70 closed is ignored, another acad bug dxf: more work on mspace hdr try several methods to get the right Model_Space header. if there's non, just skip the BLOCKS section then. dxf: skip MLINE with out_dxf looks good, but crashes on acad import api: simplify the iterator APIs we don't need the last argument, as we can use the object only. Just check its type. disable TABLECONTENT, TABLEGEOMETRY we do have coverage for those now. They fail on out_dxf, but only with wrong geom_data substructure values. Nevertheless dxf: refactor mspace BLOCKS dxf: fix BLOCKS for mspace Analog to prev. the ctrl->model_space object did not contain the default *Model_Space block records, esp. for AEC dwgs. 2018-06-16 Reini Urban dxf: add missing LAYER flags add plotflag 290 and linewidth 370. fatal in AEC dwgs 2018-06-16 Reini Urban dxf: no DICTIONARY as AcDbLayerTableRecord This reveals btw an acad 2018 bug Typo in dxfin error message: Error in LAYER Table Expected 0 LAYER or 0 ENTAB, received 0 DICTIONARY on line 6244. Invalid or incomplete DXF input -- drawing discarded. 0 ENTAB => 0 ENDTAB 2018-06-16 Reini Urban dxf: fix BLOCKS for pspace the ctrl->paper_space object is empty, we need to use the header from the header_vars to get all pspace blocks. fixes importing many r2004+ dxfs. 2018-06-16 Reini Urban dxf: special-case _B binary fix DIMASSOC to 280, fix some 290 booleans to 0/1, wrap 90-99 int32_t to signed ints. there are some -1, -2 values, i.e. MLEADERSTYLE. dxf: importing Entity MLINE crashes WIP r2004+ dxf: special-case VALUE_RD and use it with points. do not rad2deg LWPOLYLINE bulges. dxf: enable DXF groups 80 needed for some xdata. and warn on invalid or unknown xdata dxf groups. This fixes 2007/Spline with 80 and 83 BL xdata groups. 2018-06-15 Reini Urban dxf: fix r2018 $ACADMAINTVER, AcDbArc Arc is a mandatory subclass of Circle dxf: fix xdata handle, enable XRECORD dxf: fix r2007+ truetype styles needs mandatory 1001, 1000, 1071 fields. hard-code the 1071 flag to 34 for now. 2018-06-15 Reini Urban dxf: various fixes LWPOLYLINE, MLINESTYLE, ... move DXF parenthandles before the subclass markers, add r2010+ vertexids to LWPOLYLINE, fix closed flag bit. fix the broken REPEAT_CN macro (broke MLINESTYLE) simplify out_dxf: VALUE macro. separate fmt from buf and \r\n. 2018-06-15 Reini Urban 2007: silence the handle stream logging on -v4 pre-r2007. This is only really needed for 2007+ And there make it look better .gitignore: more gcov and sample output 2018-06-15 Reini Urban dxf: add check-dxf target It does not really check the dxf's, but creates a lot, for importing checks into acad. The real DXF check is in programs. 2018-06-14 Reini Urban dxf: fix more header vars add HEADER_H, CMATERIAL, INTERFEREOBJVS, ... XRECORD still crashes acad, though it does look good now. dwg: fix some header_vars mischmasch esp. TREEDEPTH was off by one, a whole section was off. dxf: improve TABLES stability A table layer entry can also be a DICTIONARY, skip that then. check all types decode: skip invalid hash_set 0 empty handle values are invalid, only appear with unhandled classes. dxf: add 330 parenthandle it should be under AcDbObject, but is in some cases under the subclass. dxf: always write a handle even for a null handle value. this is needed for DICTIONARY pairs dxf: r2007+ header fixes add several missing header vars dxf: 2004+ header fixes various, tested with r2007. this imports now until "Updating header seed." r2010 goes even until DICTIONARY. 2018-06-14 Reini Urban fix make dist, skip unreleased test-data files The release is made on travis from a fresh checkout. But locally, with .git, there can be many unrelated big DWG's lying around under test-data. Take only the files which are under git. With huge DWGs > 40MB make distcheck became unusable. This uses some GNU make extension := and $(shell ). BSD makes understands it also. Comment this out when your special make does not take that. 2018-06-14 Reini Urban dxfb: fix header and remove logging rm more .bak test dwgs These were accidentally committed. dxfb: add _REACTORS, _XDICOBJHANDLE but it fails much earlier, in the header at address 90 with a r2000 DXFB already dxf: skip empty xdicobjhandle ACAD_XDICTIONARY fields 2018-06-14 Reini Urban dxf: special-case PLACEHOLDER this is actually the only fixedtype, not just variable, which has no dxfname. checke the type instead. DXFIN r2004 still fails, without proper error message. 2018-06-14 Reini Urban dxf: add block iterator write the dxf BLOCKS section with all BLOCK .. ENDBLK entities, for model space and paper space. With these changes we can finally DXFIN (i.e. acad import) a full r2000 DXF. 2018-06-14 Reini Urban add dwg to all object/entity spec handlers e.g. to access the header vars or to resolve handles dxf: fix BLOCK_CONTROL num_entries change resolve_handle warning from Object not found to Object handle not found. This warning is mostly harmless. 2018-06-14 Reini Urban dwg2dxf: allow multiple input files add -o to name the output for a single input file only. use dwg2dxf *.dwg is so much easier. for the single file filter case we already have dwgread. restrict regen-man to POSIX only. didn't work without ./ prefix, a help2man limitation. 2018-06-14 Reini Urban in_dxf: extend scanf double we still had compiler warnings dxf: improve var types RECORD names always use the dxfname, not our internal objectname. this keeps our names nice, and DXF correct. dxf: dxf_cvt_tablerecord with r13 already do the allcaps conversion of builtin table names with r13+ 2018-06-13 Reini Urban trace: change Unhandled Class object to display the object index and handle value, not the position. With a handle we can see if it is referenced and compare to the subsequent object_map resolver errors dxf: remove most minimal See [GH #21]. There's not much need for minimal, just for writing header and entities. But not for the object fields, there are merely version specific. dxf: add XDICOBJHANDLE dxf 360 dwg: move common fields reactors, xdicobjhandle up to the common Dwg_Object_Object and Dwg_Object_Entity structs. now together with the relevant num_ and binary fields. and they don't pollute the entity specific structs. dxf: disable XRECORD for now and return no error on DUMMY, not DWG_ERR_UNHANDLEDCLASS dxf: add reactors to all objects even if not used (e.g. not used in each CONTROL table) dxf objects: simplify REACTORS XDICOBJHANDLE(3) not yet implemented (and unnecessary for now) dxf: LWPOLYLINE bulge is also in radian I think the DXF group 42 is in degrees. Found no samples yet. dxf: convert angles add rad2deg to all angles. not yet in_dxf*.c dxf: start fixing objects: DICTIONARY*, ... fixed DICTIONARY, DICTIONARYWDFLT, PLACEHOLDER, MLINESTYLE (almost). set obj->fixedtype when reading. ACDBPLACEHOLDER has no SUBCLASS marker in the DXF. Some DXF names have a ACDB prefix, maybe rename them back (again). dxf: fix REACTORS group -5 => 330 This fixed reading ENTITIES. Now we are struck at the OBJECTS section. dxf: move PROXY_OBJECT from variable to switch it does not survive the klass 500-num_classes check, and leads to an invalid dwg->dwg_class[] access. dxf: move 100 AcDbEntity after Reactors dxf: BLOCK_RECORD table only r13+ and check against libdxfrw. oh my, so many mistakes and TODOs. we need to get rid of --low again, and fix most minimal checks to version checks resort the dwg_version_as check put the most likely upfront as we have a linear search. up object_map tracing to -v4 HANDLE dwgrewrite: return only critical errors as error level result fix realloced retval for dirty_refs dwg_decode_add_object() does not always realloc anymore. only return -1 when it did, otherwise return the uncritical error bits ignore CRC mismatch warnings on r2000 for the 1st section We really need to know the numbers of setions first, to know if its broken or not. These were all false negatives. unify CRC mismatch warnings print them all in %X hex, not %x or %d ignore warnings on invalid handles now we get about the same amount of Object not found errors as there are unknown/unhandled objects, and someone is pointing to it. 2018-06-13 Reini Urban dxf: add missing LINE,... pts. POLYLINE special-case before r2004 there was no LWPOLYLINE in a DXF, only a POLYLINE. need to convert to VERTEX_2D later. there was special DXF DECODER/ENCODER logic in the spec missing out on the DXF case. simplify minimal handling on some objects on the switch, not to run into MTEXT again 2018-06-13 Reini Urban dxf: fix VIEWPORT add missing fields 68 on_off and 69 id. both hardcoded to 1 for now, as it is not stored in a DWG r13+ dwg2dxf: skip free (filename_out) also not needed, unless you are a valgrind enthusaist. dxf: fix major DICTIONARY --minimal bug with --minimal it just skipped over to MTEXT, and crashed there. document compile-time strcmp as valid The strcmp with a compile-time # pasted token and a constant is really being optimized away at compile-time https://godbolt.org/g/AqkhwL Impressive. 2018-06-11 Reini Urban rename branches, smoke policy don't smoke the open work/ branches anymore. just master, the tagged pre-releases and any smoke/ branches being worked on. 2018-06-11 Reini Urban Fix windows cr cr lf Ensure fopen wb mode everywhere for DXF. The windows msvcrt fwrite adds a \r before every \n, so we get it twice. Fixes [GH #17], thanks to Shing Liu @eryar for the report and screenshot. 2018-06-11 Reini Urban skip free with some programs time for 40MB DWG went from 3m to 7s, mostly console-out for the errors. This is with the new hash object_map. (without it was 2m) forget about valgrind reporting leaks. The kernel frees it better. The library is still leak-free of course. Closes [GH #18] 2018-06-11 Reini Urban errors: print even lower errors on success don't collapse < CRITICAL to 0 in dwgread, dwgwrite, ... stability: low error on obj_string_stream which is ignored. track dwg_decode_eed and handle errors properly, which could be disturbed by the previous obj_string_stream error. 2018-06-11 Reini Urban hash: fix the resize logic add elems for proper fillrate calculation, remove the resize size arg, not needed. don't realloc the array at resize, use a fresh zeroed space. this fixed getting back random wrong values after resize added hash tracing 2018-06-11 Reini Urban hash: allow 0 values use HASH_NOT_FOUND -1 as special not found return value, ie MAX_INT32. hash: use the new hash for the object_map WIP to speed up dwg_resolve_handle. looks a bit unstable though. hash: check against out of memory add int hash with linear probing written from scratch in 30 minutes. we disallow keys and values with 0, as they don't appear in the object_ref map. we also don't need to delete keys, so the implementation can do without tombstones (key -1), or a NOT_FOUND hash_get return value of -1. decode: fix free obj->eed[idx].raw because this could be a raw from a prev. idx. common.h: docs only dxf: strange AcDbText class separator expected move the AcDbEntity specific TEXT field upwards. skip non-public LWPOLYLINE flag values. dxf: move COMMON_ENTITY_HANDLE_DATA to the front dxf expects common data, like layer name, ltype, ... before the entity-specific subclass marker. it's a common AcDbEntity property after all. dxf: likewise rename section to table HANDLE_NAME does the name look in a table record, not a section dxf: rename dxf_write_handle to dxfb_cvt_tablerecord it's not a handle, it a table record entry. it's not a writer, it just converts/normalizes some builtin names. dxf: empty ctrl->paper_space with r2010+ 2018-06-11 Reini Urban dxf: LTYPE handle 6 => name, not hex Now all tables and blocks can be read by acad. What other handles are resolved to their name in DXF? We eventually need to replace e.g. FIELD_HANDLE (DIMTXSTY, 5, 340) with FIELD_HANDLE_NAME (DIMTXSTY, 5, 340, STYLE) to resolve with DXF to the name in the section. 2018-06-11 Reini Urban dxf: adjust control 70, add BLOCK_RECORD the BLOCK_RECORD table records are apparently mandatory. acad complains when missing. 2018-06-10 Reini Urban dxf: always set the global *_control objects we need at least the handle for dxf dxf: fix TIMEBLL format add the double calculation (for the binary dxf). fix the trace and DXF output. doc: PythonCAD R38 also uses LibreDWG http://pythoncad.sourceforge.net/dokuwiki/doku.php?id=r38_roadmap dxf: tables are mandatory not optional. dxf: fix AcDbDimStyleTable handle code 105, no special-case for num_entries add missing group 71 dxf: progress with tables add the missing the layer table subclasses, special-case the control handle, and the BLOCK_HEADER name. const some objects remove all the prev. added RECORD () for the object names. dxf: avoid empty numbers only strings may be empty. numbers will be changed to 0 dxf: strip ending .00000000000 for .0 and .5. It's just a heuristic but catches most cases. I don't want to invest much more into this mere beauty issue. 2018-06-10 Reini Urban dxf: fix wrong LTYPE type description which has DXF type 3, not 48. add a check to avoid empty numbers, only allowed for strings. rather print 0 then 2018-06-10 Reini Urban check-dwg-valgrind: less verbose, small files only we only care for segfaults, not the field tracing. the log file already gets huge. restrict check-dwg-valgrind to DWGs size < 10M, check-dwg-valgrind to size < 40M. 2018-06-10 Reini Urban alive.test: rm core file writers may create core files, which may fail the distuninstall test 2018-06-10 Reini Urban fix reading huge files Fixes reading DWG files >40MB with many elements exceeding the previous hardcoded limits. E.g. this example had 789388 objects and 2453916 object refs. Note that the decompressed sizes are bigger than the filesize, roughly by factor 2.0. It is really slow though. The object_refs hash table really improves it from 2m to 5s. See https://savannah.gnu.org/bugs/index.php?28503 2018-06-10 Reini Urban section decode stability fix some uint32_t types (not unsigned long on amd64), fixing some overflows. check and abort on more 2004 and 2007 invalid section sizes. thanks to llvm scan-build CI: remove --enable-write 2004 stability: skip empty or wrong sections I got one broken 2007 DWG, which when saved as r2004 is also broken. Don't segfault, at least error gracefully. See https://savannah.gnu.org/bugs/index.php?28503 2007: more file_header logging add len2, which is always 0. in_dxf: sscanf %lf for double clang warning: format specifies type 'float *' but the argument has type 'double *' 2018-06-09 Reini Urban dist: add regen-man, fix distcheck Stabilize the creation of the man files. They are only generated by the maintainer, not generally. Copy them from srcdir, not builddir. Add temp. logs to CLEANFILES Add PACKAGE_URL for bugreports 2018-06-09 Reini Urban errors: pass through 2007 errors don't report success with Failed to read 2007 meta data stability: improve reading broken r2007 files got a sample DWG which asserted. Convert assertions to proper errors. docs: update we are near the first release. programs: fix --help features default to --enable-write switch to --disable-write xmlsuite: Helix => HELIX and fix another classes overflow. 2018-06-09 Reini Urban move classes dispatcher into common.inc no various copies around. Now the variable typed classes are maintained in one and only place. Just the static ones have copied switch tables, but this number is fixed. There will be no new ones, so I'm fine with that. sort classes.inc by stability, entity, and names. 2018-06-09 Reini Urban major varying classes refactor abstract away the several types of class stabilities in the switch dispatcher: stable, untested, debugging and unhandled. In the next commit we will extract the class dispatchers into one single classes.inc. free is now a bit slower because of the dynamic strcmp dispatcher checks, but we win in massive consistency improvements. This could also be improved later by switching to dynamic enum/int checks. fix typo: DICTIONARYWDLFT => DICTIONARYWDFLT, add HELIX set obj->fixedtype, to the fixed enum DWG_OBJECT_TYPE, which is independent on the class index. then you don't need to check the dxfname anymore, and we can possibly get away with all the strcmp dxfname. This must be enforced by all importers (in_dxf*, ...) also. collapse the various SURFACE types to one SURFACE entity, in DXF there's only one SURFACE entity. Fixed various dead-code issues in VBA_PROJECT, MULTILEADER. Some latest changes were hidden behind DEBUG_*. Now not anymore. 2018-06-09 Reini Urban appveyor: deploy as pre-release not as draft anymore. They are stable enough to warrant official nightlies. Such a pre-release creates a tag, which triggers a travis make dist deploy. Before I had to manually trigger each drafted release, which you didn't see. Now it goes directly to public pre-releases. 2018-06-08 Reini Urban dxf: cleanup from prev. errors refactor 2018-06-08 Reini Urban rename AcDbField to FIELD, tested ok found an example with it. Looks broken at childs[0] [H 360] and then at evaluation_error_msg [T 300]. num_childs occurs twice. the first is unreliable. if >0 dec by one. but really num_childval 93 is better. FIELD and FIELDLIST are now tested ok. 2018-06-08 Reini Urban fix TABLE crashes with free. The TABLE fields look pretty wrong to me. Also add a DATATABLE skeleton errors: add to docs errors: add DWG_ERR_CRITICAL for programs Don't report errors if less severe than DWG_ERR_CRITICAL. i.e. DWG_ERR_VALUEOUTOFBOUNDS. Same for the high-level dwg API: dwg_read_file, dwg_write_file dxf_*_file. 2018-06-08 Reini Urban errors: pass through decode/encode/print/... The errors are now severity sorted bitmasks, and we pass it all through, just not the bits API, as this is functional without *error retval. We don't stop on any coding error, we just accumulate the error bits. Every dwg_TYPE_##token function returns now an error code. Flip the dwg_TYPE_variable_type() logic to return 0 on success and DWG_ERR_UNHANDLEDCLASS to switch to UNKNOWN_* Fix the annoying in_dxf char** warnings. 2018-06-08 Reini Urban errors: add error codes to decode_r2007.c errors: add DWG_ERR_CLASSESNOTFOUND errors: add error codes to bits.c/dwg.c errors: add error codes to encode errors: add error codes to decode but not yet through the dwg_decode_OBJECT path via dwg_decode_add_object. add .drone.yml for tea-ci.org Add .gitlab-ci.yml NanoSPDS marker classes This is a flexlm License Parser. Just classes, registered as entity, not found in entities though. Found in AEC and MAP dwg's dxf: special-case POSITIONMARKER dxf name and add some minor stuff add unsorted UNDERLAY, fix EXTRUDEDSURFACE change DUMMY, LONG_TRANSACTION to objects. DUMMY is never a proper object, it is just a generic dwg filer method. (proxies?) add some missing COMMON_ENTITY_HANDLE_DATA 2018-06-07 Reini Urban add GEOPOSITIONMARKER geojson at least rudimentary, with Text add unsorted EXTRUDEDSURFACE entity with known DXF fields. r2007+ no coverage in any DWG yet. None of the SURFACE entities fix clang's dangling else warning .gitignore: ignore more TODO: check test coverage for missing entities/objects in our catch-all example_2000.dwg the best is actually 2018/example_2018.dwg with 21 entities out of 60. list all missing entities/objects to be added into a better all.dwg for better test coverage print: tighter logging print UNKNOWN bytes tighter without space. print points as (...) list 2018-06-06 Reini Urban dwg.h: fix some _RC to _BS only done in the spec previously with 323efd78ea, so we had a mismatch. only detected on windows. fix windows deploy: not the libtool wrappers Fixes #15 The windows make install does not put the proper binaries into bin, so we went and copied it manually. But the wrong ones. 2018-06-06 Reini Urban extend xmlsuite add support for a couple of more elements, in fact all elements found in the prepared XMLs used for this test. Even some custom class Helix, which doesn't have a graphical representation in the DWG, only a class definition. 2018-06-06 Reini Urban docs: update Copyright headers for all recent significant changes windows: add declspec(dllimport) for external programs linking to the dll, ie where DLL_EXPORT is not set (libtool does this for us). doc update and rename the CRC field in header_variables to crc, to match the docs. Only uppercase matches DXF vars. free: FREE_IF objects dwgrewrite: default to r2000, stability write: don't error on empty fields or handles. more objects: GEOPOSITIONMARKER, CAMERA and some minor fixes: PLOTSETTINGS, MATERIAL. CAMERA should not be in any DWG, but maybe in a DXF or other format. rename some PLOTSETTINGS fields for consistency with LAYOUT. some crosschecks with the oarx docs. more plausible SUN fields light reorder. problem is that we don't have a SUN object in any DXF yet, just the class. will do that later. 2018-06-06 Reini Urban more SUN found documentation. it's not a table entry (no name), it's rather a singleton. now we have 46 bits unknown bits left (some doubles: direction, altitude, azimuth?), and the order is yet unknown. fix MATERIAL RC to BS types. add some more SUBCLASS markers from newer DXFs 2018-06-05 Reini Urban add SUN, OBJECT_PTR SUN misses 11 byte/3 bit. OBJECT_PTR not yet tested add unsorted fields for PLOTSETTINGS, LIGHT dxf: add all the missing dxf SUBCLASS markers (with help from the ARX docs), also table control objects. add field docs for PROXY_ENTITY, LWPOLYLINE, MLINESTYLE, fix dxf output for LWPOLYLINE (with bulges and widths), rename WIPEOUTVARIABLE to WIPEOUTVARIABLES api: 3dsolid, spline, mline, dictionary several api fixes. do not use an Entity/_ent prefix for non-entity substructs. doc: fixup bits.h endcode dxf: fix some MTEXT groups and rename some fields, add some docs. 2018-06-04 Reini Urban api: more const, restrict, docs also replace all BITCODE_BD with double. 2010: improve stability can now read even the prev. failing AEC DWGs. fix setting the ent->color.name (not alloced) skip invalid EEDs skip invalid and unknown objects fix some -Wformat warnings 2018-06-04 Reini Urban unify REPEAT macros move them to the common spec.h. Just decode has different variants, with calloc. add a couple of unchecked variants, when either the type or a constant int make the rcount overflow check useless. To avoid compiler warnings. 2018-06-04 Reini Urban 2010: adjust TODO 2018-06-04 Reini Urban 2007: fix section_string_stream for overlarge data_size The overflow logic with hi_size was wrong. Too small type. We can now read many AEC drawings with a data_size > 0x8000 and >300 classes. E.g. Autodesk Architectural Desktop 2007. But some of them are still problematic. Allow reading r2010+ now with a tarball release, and enable the xmlsuite for it. But programs/alive.text does not work yet with Leader_2010+: dwg2dxf 2018-06-04 Reini Urban 2010+: enhance stability, update docs make check and most DWGs pass now. stability: skip tables/vectors with more than 0x1000 entries: REPEAT, reactors. fix entity picture size (IMAGE, WIPEOUT) from BLL to BL, but this is still buggy for 2010+. skip it. skip empty table names. dxf: skip unknown objects and tables, i.e. some newer VIEWSTYLE tables. test: skip the DXF comparison check, as it is not ready yet. the diff became too large. 2018-06-03 Reini Urban 2010: fix the remaining stream offsets harmonize entities with objects. Now most fields can be read, just a few are broken. The 2010 DWGs itself report success. 2010: add UMC unsigned type for handlestream_size and revert the old object map offsets to signed MC. This fixes now most Objects, just one still broken. Now Entities are left. bits: fix MC type to unsigned it cannot be negative at all. Fixes the r2010+ objects with negative Hdlsizs, but broke many earlier dwgs. 2010: fix object hdlpos + 8. Now just the bit_read_MC is broken, sometimes returning negative values. 2010: fix object bitsize calculation 8*size - handlestream_size the object string stream is now correct, missing just the handle stream offset. 2010: fix Header offsets The string and handle offsets are also correct now. 2018-06-03 Reini Urban 2010: fix Classes section_string_stream endbit 8*24 = 192: bitsize + 191 Now we can read all the 2010-2018 Classes 2018-06-03 Reini Urban dxf: fix XRECORD objid_handles wrong order of arguments. Only relevant for out_dxf api: add missing restrict api: add several table/handle helpers rename dwg_obj_ref_get_abs_ref to dwg_ref_get_absref dwg_obj_reference_get_object to dwg_obj_ref_get_object add dwg_ref_get_table_name (default: ByLayer), dwg_ent_get_layer_name (default: 0), remove dwg_ent_m?insert_get_ref_handle, dwg_ent_m?insert_get_abs_ref, replaced by dwg_ent_m?insert_get_block_header. enhance dwg_obj_table_get_name: allow a DICTIONARY (e.g. a material or plotstyle handle) also. use it in the enhanced xmlsuite for common_entity_attrs(). xmlsuite: various improvements simplify, add vertices, ... 2018-06-02 Reini Urban r11: more work on pre-R13 entities read all the remaining common entity fields. fix INSERT and the entity handle. WIP skip entities at an invalid size. performance: use the REFS_PER_REALLOC pool now also for dwg->object, not just for dwg->object_refs. 2018-06-02 Reini Urban after add resolve all objectrefs walk through the object_ref array and re-resolve all found objects. set dirt_refs when the object array was realloced, to skip using the cached handleref->obj, but re-assign it. add more restrict to the encode API 2018-06-02 Reini Urban testcases: silence -Wpragma-pack 2018-06-02 Reini Urban api: use -fvisibility=hidden to export only public funcs This mimics the default visibility on windows. Closes GH #13. Some internal unit-tests failed to work, they need to link to the object file also, not just the library. 2018-06-01 Reini Urban use $(WARN_CFLAGS) do not copy WARN_CFLAGS into AM_CFLAGS, rather allow changing it later and using it in CFLAGS. Before changing WARN_CFLAGS had no effect at all 2018-06-01 Reini Urban parent: change object uplink to objid Dwg_Object_{Object,Entity}: change object to objid field. add dwg field. add 2 new API functions to return the Dwg_Object from the obj_obj, resp. obj_ent via the objid. Closes GH #11 2018-06-01 Reini Urban parent: SET_PARENT macros this doesn't yet fix the moving obj problem from #11, but it looks much better now. The next commit will fix the remaining link to the moving obj. refman: remove flymake temp. parent: move parent to the front for generic ensure structural integrity, ent_generic just casts the struct. also add a couple of testcases, remove the obsolete dummy fields from DUMMY, SEQEND and ENDBLK, add testcases for the parent API fix more parent setters in some structs, check if the child was even created. rename some childs to proper names. api: rearrange the c file a bit separate generic ent section. improve the docs for dwg_get_type. 2018-06-01 Reini Urban api: add functions to get the parents add dwg_ent_generic, dwg_obj_generic, dwg_tbl_generic types. add dwg_ent_generic_to_object, dwg_ent_generic_parent, dwg_obj_generic_to_object, dwg_obj_generic_parent functions. Closes [GH #11] 2018-06-01 Reini Urban api: link most the complicated parent fields TABLE, TABLESTYLE, TABLEGEOMETRY, FIELD, LAYER_INDEX substructs. I might have missed some. See [GH #11] 2018-06-01 Reini Urban api: add parent field to each _dwg_{entity,object}_ENTITY See [GH #11]. We have to jump through absurd hurdles in the API to get around that. The parent points to the _dwg_object_{entity, object}, which points via the object field to the _dwg_object. Also add parent fields to each subentity, such as e.g. MLINE_line - > MLINE_vertex -> MLINE, and HATCH. 2018-06-01 Reini Urban man: bump month to June 2018 logging: display handles as hex to match with the DXF 5 and 330 groups. display the objid index also as hex. encode: disable write modules don't even compile encode and the DXF in_* modules, to save compile-time and object size. they are quite large. 2018-06-01 Reini Urban dwg: add unsorted MATERIAL fields needs CFLAGS="-DDEBUG_MATERIAL" so far the first two text fields: name, desc are known, the rest unknown. 2018-05-31 Reini Urban dxf: fix LTYPE table 2018-05-31 Reini Urban fix compiler warnings avoid unused functions warnings, add them to some if(0) {} dead block. add a LAYER_TABLE_FLAGS type specialization: because of the LAYER flags RS type, not RC. now just the WIP in_dxf.c throws a lot of warnings. 2018-05-31 Reini Urban dxf: more loop stuff add DXF_BREAK_ENDSEC, SECTION(THUMBNAILIMAGE). but we will abandon that und use the alternate approach. 2018-05-31 Reini Urban api: add generic table getters the name of an entry, the entries as array of refs, and all the common fields of a table control object. rearrange internal layout, use COMMON_TABLE_CONTROL_FIELDS to guarantee a common control table layout, to access all entries from the obj, not the Dwg_Entity_OBJECT. 2018-05-31 Reini Urban api: add more table apis so far we only cover block, layer and appid tables. add generic dwg_obj_table_get_name, and dwg_obj_tablectrl_get_num_entries. TODO: dwg_obj_tablectrl_get_entry(index) and dwg_obj_tablectrl_entries - all and the API for the special control objects. not sure if the layout for all control objects is the same, to access the handles. 2018-05-31 Reini Urban doc: remove useless Macro call to cast prefix its not relevant, and clear to everybody. 2018-05-31 Reini Urban api: remove the entity init functions also this is the same as memset(0), affecting only the few geometric fields. it's distracting that all the common fields are unaffected. what would be useful would be to reset/init the common entity and object fields and handles, but there's no API for that yet. 2018-05-31 Reini Urban api: remove the wrong new/delete/free functions these were only entity specific, and didn't add them to the DWG an object consists of the generic Dwg_Object, a common-entity Dwg_Object_Entity and the specific Dwg_Entity_ENTITY. Use the dwg_add_ENTITY and dwg_free_object API instead. Closes GH #10 2018-05-31 Reini Urban api: add dwg_add_##ENTITY to the public API change the return value to the newly created object. also add the counterpart dwg_free_object() to the public API. src/free.h is now empty and could be removed. (later) The next commit will remove the wrong dwg_ent_ENTITY_new/delete/free functions from the API. See [GH #10] 2018-05-31 Reini Urban api: warn about useless _new functions See [GH #10] and the note in the previous commit. 2018-05-31 Reini Urban api + doc: improve dwg_api for CIRCLE,LINE,ARC add const, restrict and API docs. dwg_ent_*_delete: remove error arg. free can handle NULL just fine. FIXME: Note that these new/delete/free functions are basically useless, as they don't add the entity to the DWG. We need to add a Dwg_Object and the associated Dwg_Object_Entity and then this Dwg_Entity_CIRCLE. See encode.c for dwg_add_##ENTITY for the proper API. 2018-05-30 Reini Urban api + doc: improve dwg_api for TABLE add error checks, and API docs. doc: more bit type descriptions fixup internal api: cleanup extern and headers version_codes may not be duplicated. duplicate symbol _version_codes in: .libs/dwg.o .libs/common.o *.inc: add emacs c-mode lines add -Wchar-subscripts, which is default on cygwin prevent signed char from being used as array index, e.g. isprintf(*string) fix -Wchar-subscripts warnings isprint might involve arrays, and a char index might be signed, which is UB. Only detected on cygwin. 2018-05-30 Reini Urban cygwin: strdup fixes, ... strdup is not ANSI, we need some POSIX spec to enable it, esp. on cygwin. the spec needs obj_string_stream, which is defined in decode.h (only detected by cygwin) 2018-05-30 Reini Urban configure: fixup skip valgrind on cross_compiling autoconf is a bit too fragile TODO: update add example_2000.dxfb, a binary DXF in_dxf: revise plan (comments only) 2018-05-30 Reini Urban windows: fix programs man rules, typo first dwgread.exe was built, but then for the .1 page dwgread was built, using the internal cross-compiler rules which missed AM_CFLAGS. since building the .1 pages would need wine for help2man I rather skip those rules under HAVE_MINGW_CROSS 2018-05-30 Reini Urban configure: skip valgrind on cross_compiling avoid setenv warning when --enable-trace was not enabled, as it is not needed without tracing. improve dejagnu warning. only one of 4 major testsuites are skipped then. 2018-05-30 Reini Urban internal api: cleanup extern and headers add all resused functions to all internal headers. this was a mess. again thanks to mingw-gcc, which is a bit stricter in this regard. get rid of wrong extern decl. we don't use any extern functions, only library internal ones. 2018-05-30 Reini Urban dxf: use L"" on windows for VALUE_TU 2018-05-30 Reini Urban fix massive obj_string_stream bug I once wrote it to take the bitsize as 2nd arg, and then refactored it to take the object. (for the has_string flag). Not after carefully readng the mingw gcc warnings, I didn't use it in the header, but manually pasted the decl into the c files. but just the old decl! Tahts why the string stream offset calculation was so unstable. This should improve the r2007+ situation a lot. Add reused functions to its headers and use it. Add restrict to the dwg_decode_##token methods Fix redundant redeclaration of 'dwg_decode_add_object' 2018-05-30 Reini Urban appveyor: measure used space/free space we have a 80GB quota. see if logs and artefacts affect it. 2018-05-29 Reini Urban programs: fix error handling fix verbosity num_args avoid free of empty dwg, zero the struct before returning a file not found error decode: more PT tracing in shorter lisp fashion: DD, 2DD, 2BD_1, 3BD_1 dxf: fix dwg_dxf_object -Wmissing-prototypes fix no previous prototype for function 'dwg_dxf_object' [-Wmissing-prototypes]. also for dwg_free_xdata_resbuf. This is not useful publicly, so make it static. more header_write returns they need an int now. control reaches end of non-void function [-Wreturn-type] api: remove redundant declarations of dwg_get_num_objects, dwg_get_num_entities. They are already in dwg.h/dwg.c travis: sha1sum => sha256sum already announced in the ChangeLog but missed it in_dxf: more checks and fields dxf_read_file: fail on DWG file out_dxfb: copy from dxf add a couple of restrict and remove the unneeded out_dxfb.h header in_dxf: more return type fixes. in_dxf: fixup return values which we need for checking EOF in_dxf: restructure loop add a few helpers in_dxf: add dxf_read_pair always read pairs in_dxf: sscanf is broken for me handroll our own. still need to read record pairs, and use a common loop to assign the values to the fields. 2018-05-28 Reini Urban in_dxf: start reading the dxf WIP not from the dat->fh but the chain. fails on the first sscanf call. abstract away macros with constant strings, because we cannot write to those strings: SUBCLASS for the readonly subclassmarker 100 group 2018-05-28 Reini Urban write: add internal dwg_add_TYPE api For dwgwrite/dxf2dwg we need to create/add arbitrary dwg objects. (e.g. from dxf) Add all the add functions to encode.c/.h (later eventually to dwg_api.h) rename DWG_TYPE_3DSOLID to DWG_TYPE__3DSOLID for consistency (to create it by type) ditto for PROXY rename to PROXY_OBJECT (even if the DXF name is only proxy) add fixed DWG_TYPE_object enums for all variable objects, they don't match the real obj->type field, which is the class id + 500. But the type is needed temp. for the add API. Create the objects from an empty/zeroed Bit_Chain stream. Suppress all warnings/errors there. field values and arrays need to be added later. This just allocates the room in dwg->objects and set's up the Dwg_Object and Dwg_Object_##type, and esp. applies all the encoding default values from dwg.spec. 2018-05-28 Reini Urban in_dxf: implement helper structures global Dxf_Objs holding all objs (header_vars, entities, objects) and its fields. add dxf_add_field for FIELD() and dxf_search_field for the 2nd round linear search is enough for those 30 objs, and max 20 fields. no binary search or hash needed here. these can be used for both ascii and binary dxf. (probably also for in_json) remove unneeded in_dxfb.h. we share all with in_dxf.h, only the field getters are different. 2018-05-28 Reini Urban in_dxf: TODO plan 2018-05-28 Reini Urban distcheck: add doc and programs DISTCLEANFILES and MAINTAINERCLEANFILES. Note that the man's are in git and the dist. add more DISTCLEANFILES without libps or enable-write. clean it then, because we didn't create it. 2018-05-28 Reini Urban doc: more doxygen, add refman, refman-pdf targets I tried to include the generated tex files into our texinfo, but this is not easily possible. The GNU stdlibc++ tried also but eventually uses two separate manuals, the texinfo and the doxygen generated. TODO: Integrated the doxygen refman html output into our generated manual. With html this should be easy. 2018-05-28 Reini Urban doxygen: probe and add as make target start some documentation effort, still looks horrible. the latex parts can then be included into our manual. htags is not much better, but at least properly clickable through. 2018-05-28 Reini Urban api: empty args check, null malloc simplify the boolean empty args checks. fix wrong error messages: null malloc when out of memory, empty arg when the arg was missing (NULL) api: rename api lwpolyline methods back to lwpline analog to AutoLISP method names. There it also abbrevated as lwpline 2018-05-27 Reini Urban api: rename LWPLINE to LWPOLYLINE this is the real entity name, in the AcDb and DXF 2018-05-27 Reini Urban dxf: more entities the 5 handle is mandatory, also add the common 330 and 100 values. temp. disable some broken tables. 2018-05-27 Reini Urban dxf: fix minimal HANDSEED crash it needs to be a valid value >0. disable BLOCK in TABLE disable BLOCK,ENDBLK in ENTITIES dxf: add 70 flag to all tables, harmonize layer flag all tables need a flag, set it in COMMON_TABLE_FLAGS. we don't need the extra flag_s short for layers, use one only. 2018-05-27 Reini Urban * src/out_dxf.c: dxf: add VALUE_BINARY for xdata and THUMBNAILIMAGE split into mult. lines of max size 127 (as %02X hex) * include/dwg.h, src/dec_macros.h: logging: shorten points log most 2d/3d points as %g (no ending zeros) and in parens as in AutoLISP. * src/dec_macros.h: decode: trace handle absolute as hex in DXF they are only used as hex. easier verification * src/out_dxf.c: dxf: 100 groups only with r2000+ 2018-05-27 Reini Urban * src/out_dxf.c: dxf: more minimal cleanup, and several fixes avoid duplicate entity 0 RECORDS, fix FIELD_VECTOR: LWPLINE bulges, avoid 330 handles and 100 names with minimal. but we still get a eNullHandle assertion on ACAD import. 2018-05-27 Reini Urban * programs/dwg2dxf.c: dwg2dxf: fix -m --minimal arg processing on another note: acad will crash with our -m dxf file so far :( we need to minimize it a bit more. * src/out_dxf.c: dxf: skip empty TABLE_CONTROL null_handles 2018-05-27 Reini Urban * src/out_dxf.c: dxf: fix duplicate 5 handles we emit the owner 5 handle already with DWG_OBJECT for all objects, skip it for COMMON_TABLE_CONTROL_FLAGS and COMMON_TABLE_FLAGS. acad import still fails at table APPID 2018-05-27 Reini Urban * src/decode.c, src/dwg.spec, src/out_dxf.c: dxf: add dxf_write_xdata for XRECORD 2018-05-26 Reini Urban * src/dwg.spec, src/in_dxf.c, src/out_dxf.c, src/spec.h: dxf more DICTIONARY and XRECORD fields but the 102 names for XRECORD not yet. 2018-05-26 Reini Urban * src/out_dxf.c: dxf: add DbSaveVer if --as-rNNN when a VPORT table was saved in a newer version, dxf-out this version as DbSaveVer,1000. This is the only table with DbSaveVer. Some objects do have a AcDbSavedByObjectVersion tag, for the class version. 2018-05-26 Reini Urban * include/dwg.h, src/dec_macros.h, src/decode.c, src/dwg.spec src/encode.c, src/free.c, src/out_dxf.c, src/out_json.c, src/print.c: dxf: rename VIEWMODE, fix table num_entries VIEWMODE is a systemvariable, renamed from view_mode in VPORT and VIEW. combine UCSFOLLOW with it (for encode and dxf). via DXF the num_entries don't count the control entities. initialize and DXF the VPORT_CONTROL->flag * .appveyor.yml: appveyor: decrease disk usage delete the deployed zips. I hope this decreases the quota which is 80GB per user. * src/dwg.spec: spec: simplify encode_3dsolid decl make it static so we can avoid the decl. log the error that encode_3dsolid is nyi (not yet implemented) 2018-05-26 Reini Urban * include/dwg_api.h, src/dwg_api.c, test/testcases/3dsolid.c, test/testcases/body.c, test/testcases/region.c, test/unit-testing/3dsolid.c, test/unit-testing/body.c, test/unit-testing/region.c: api: rename dwg_ent__get_{wire,silhouette} to get_wires, get_silhouettes. It returns the array of all, not just one. 2018-05-26 Reini Urban * include/dwg_api.h, src/dwg_api.c: api: remove array num setters there exist various api functions to change the number of some elements without changing the associated array itself, e.g. dwg_ent_polyline_mesh_set_num_n_verts without setting the n_verts array. all the set_num_ api functions need to go. this is unsafe. set_num_owned, set_numcols, set_numrows, set_num_lines, ... See [GH #9] not yet added add_array (i.e. push) and delete_array(at_index) apis yet. 2018-05-26 Reini Urban * include/dwg.h, include/dwg_api.h, src/dec_macros.h, src/decode.c, src/decode_r2007.c, src/dwg.c, src/dwg.spec, src/dwg_api.c, src/encode.c, src/free.c, src/in_dxf.c, src/in_dxfb.c, src/out_dxf.c, src/out_dxfb.c, src/out_json.c, src/print.c, test/testcases/insert.c, test/testcases/minsert.c, test/testcases/polyline_3d.c, test/testcases/polyline_mesh.c, test/testcases/polyline_pface.c, test/unit-testing/insert.c, test/unit-testing/minsert.c, test/unit-testing/polyline_3d.c, test/unit-testing/polyline_mesh.c: api: rename *_count fields to num*, owned_obj_count + owned_object_count => num_owned, insert_count => num_inserts, instance_count => num_instances, frozen_layer_count => num_frozen_layers, FIELD_INSERT_COUNT => FIELD_NUM_INSERTS, object_count => num_objects: dwg_get_num_objects already existed in dwg.h, remove duplicate from dwg_api.h, entity_count => num_entities: dwg_get_num_entities already existed in dwg.h, remove duplicate from dwg_api.h, m_vert_count => num_m_verts, n_vert_count => num_n_verts, attr_def_count => num_attr_defs, Closes [GH #8] 2018-05-26 Reini Urban api: rename VPORT_ENT to VPORT_ENTITY for consistency. we don't use the ENT abbreviation in no other object, but we do use _ENTITY already dxf: oops delete a .bak test-data file dxf: fix VPORT aspect_ratio 41 The real aspect_ratio needs to be divided by the viewsize, since r13 at least. <=r12 stores the real aspect_ratio already. dwg2dxf: fix printing as version to stdout not stderr dxf: use more dxf_write_handle conversions also for the name in COMMON_TABLE_FLAGS, as those names also need conversions. also add *Active dxf: $MEASUREMENT is r14 already simplify the logic also dxf: $UCSBASE is r2000+ only dxf: write even empty names/strings don't skip the 1 group of e.g. DIMBLK1 convert unicode names to utf8 convert reversed standard names if read from newer and write as older. 2018-05-26 Reini Urban dxf: abstract HANDLE_NAME to dxf_write_handle since r2000+ some Standard handle names are renamed: STANDARD to Standard, BYLAYER to ByLayer, BYBLOCK to ByBlock. also check that the table name is really an object, not an entity. 2018-05-26 Reini Urban dxf: add examples in more versions sample_2000.dwg in r14-2018 DXF formats example_2000.dwg in 2018 dwg and dxf formats alive.test: add filt_dxf.pl to normalize POSIX sprintf("%-16.14f") floating point numbers to the format used with MSVC with native AutoCAD, so that we can easily compare the output of oursvs them. 2018-05-25 Reini Urban restrict: add C99 restrict pointer decls just a few pointers might be the same: dat, hdl_dat and str_dat. 2007: fix unaligned access on copy_n helpers 1-3 is reverse, 4-8 is straight. 16 is reverse 8-wise. just use memcpy 2018-05-25 Reini Urban dxf: special-case VPORT field order for DXF output. fixed some wrong VPORT fields: sun_handle -> shade_plot_handle 333 (vport owns these) view_twist_angle -> view_twist for consistency aspect_ratio 41 is still wrong view_twist 50 -> 51 back_clip 33 -> 44 also fix the common table format a bit allow DXF groups in the spec 2018-05-25 Reini Urban dxf: support Standard in HANDLE_NAME the DWG Standard table entry_name is called STANDARD, but in the DXF it is translated to Standard. Also simplify HANDLE_NAME to avoid the tmp buf, names are always strings. 2018-05-25 Reini Urban man: fix dependency problem and POSIX/Windows compat The .1 files depend on the c and the binary. remove the $(*F) gnu make-ism. enable windows compat to generate the man pages. improve the man target: no submake's, enable proper deps. Fixes spurious help2man: can't get `--help' info from ./dwgwrite errors when the binary was not generated yet in parallel builds. Closes GH #4 2018-05-25 Reini Urban appveyor.yml: skip_tags: true we tag only already tested and deployed commits. avoid double smoking on our slowest smoker. on the other hand travis needs the tag to deploy the generated dist's to this tag. 2018-05-24 Reini Urban fix bit_utf8_to_TU, 3 byte case. detected by gcc-8 praise the good compiler. warning: bitwise comparison always evaluates to false [-Wtautological-compare] encode: return early for 2004 to avoid useless hangs 2018-05-24 Reini Urban stability: return 0 on bit overflows when a number is wrong we prev. returned -1, leading to abnormal high numbers, sizes. rather zero it to be able to continue on some unknown data. avoid bit_calc_CRC overflows 2018-05-24 Reini Urban dwg_decode_handleref_with_code: fix null pointer dereference api: fix null pointer dereference add build-aux/dejagnu.h.patch this header throws too many warnings with newer clang's. for now only suppress clang warnings, gcc not yet. (only tested until gcc-6 on macports. no idea about gcc-8) rename VP_ENT_{HDR,CONTROL} to more natural names. AutoCAD used ViewportEntity (r11-r2000). Analog to block use VPORT_ENT_CONTROL and VPORT_ENT_HEADER. rename {ucs,block,view}_control_handle to *_control to harmonize all the control handles, which have no suffix. 2018-05-24 Reini Urban rename SHAPEFILE to STYLE see [GH #7] nobody else names it SHAPEFILE, only the ODA. dxf names it STYLE and $TEXTSTYLE, AutoCAD names it AcDbTextStyleTable, libdxfrw names it STYLE and TEXTSTYLE 2018-05-24 Reini Urban geojson: use the new APIs for polyline_2d, polyline_3d and add point. api: add polyline_3d points api and remove the badly named owned_obj_count field api api: const most getters 2018-05-24 Reini Urban dxf: more table control fields each table has at first the control object, and then the COMMON_TABLE_FLAGS(owner, acdbname) before the other fields, not after. special-case this. add a new objid to each control object, as link back to the Dwg_Object (e.g. for the owner handle). 2018-05-24 Reini Urban dxf: add PUCSORTHOREF, fix HANDSEED dwg2ps: use the new pline points API cbmc: experimental CBMC rule for bits_test.c To create coverage testcases. Does not work so far, and needs an insane amount of time. Should be limited to single functions only. 2018-05-24 Reini Urban api: rename pline numpoints, add get_points API numpoints is different across versions. add a get_points API for various pline types, this is also different across versions. 2018-05-24 Reini Urban json: new geojson output formatter only LINE,LWPLINE,POLYLINE_2D,INSERT (unexploded) entities so far. TODO: facetting of curves, ocs/ucs transforms, use the new pline points api. TODO: NOCOMMA and \n not with stdout. stdout is line-buffered so NOCOMMA cannot backup past the previous \n to delete the comma. We really have to add the comma before, not after, and special case the first field, not the last to omit the comma. 2018-05-23 Reini Urban dwg2ps: fix POLYLINE_2D wrong loop index 2018-05-22 Reini Urban dxf: remove wrong test dxfs we compare now our own created dxfs against {ex,s}ample_2000.dxf unfortunately they don't match the versions. create proper ones later, the one remaining should be enough for now. travis: simplify distcheck distcheck already creates the tardists. add sha256sum (in ubuntu coreutils), we upload them to github releases. travis: deploy releases on tags 2018-05-22 Reini Urban appveyor: re-try mingw install install-binPROGRAMS is not triggered, do it manually. also install examples/*.{c,exe} move the dll to the root, together with all the programs. on windows they should stay together. the rest is devel stuff. 2018-05-22 Reini Urban dwgwrite: improve encoding of empty data. alloc empty sections and section_info. allow empty handles (null_handle). set the default version for dwgwrite to R_2000, support --as-rNNNN add the dwgwrite.1 dxf2dwg.1 man pages README: write is good enough for r2000 for most DWG's, some not yet. 2018-05-22 Reini Urban add API unicode support (for r2007 strings, optional) convert UCS-2 to utf-8 (char*) add bit_convert_TU() and bit_utf8_to_TU() converters, bit_convert_TU() was prev. only latin-1, now full utf-8. converters written from scratch, they are trivial. Ken Thompson designed it that way. not rejecting any wrong utf-8 encodings yet. add dwg_api_init_version(&dwg) for the version. only needed since r2007, utf-8 is backwards compatible. ucs-2 not. call inlined dwg_api_init_version on every API function with an Dwg_Object or Dwg_Data. 2018-05-21 Reini Urban add dwglayers Prints all layers in a DWG. improve help2man rule, avoid --version warnings. 2018-05-21 Reini Urban cmp_dxf.pl: add some basics dxf: change float printf format to %-16.14f on windows it is different. %g swallows the ending zeros dxf: use DOS EOL \r\n HACKING: add fuzzing with afl-fuzz fast enough on linux without our own loop so far. 2018-05-21 Reini Urban dwg_read_file: support - for stdin dwgread - now reads from stdin. I needed it for afl-fuzz, but should come handy elsewhere. dwgwrite already supports reading from stdin. * dwg.c (dat_read_stream,dat_read_file): helpers added. (dwg_read_file): use it. 2018-05-21 Reini Urban TODO: update practical TODOs smoke.sh: delete duplicate python3.6m. 2018-05-20 Reini Urban dxf_format: add new DXF codes up to r2014 bits_test: improve flapping CRC tests realloc creates uninitialized memory smoke: whitespace only bits_test: stabilize avoid uninitialized memory, leading to problems with -O2 2018-05-20 Reini Urban dxf: encode linetype_flags BYLAYER/BYBLOCK/CONTINUOUS enable MLINESTYLE which has a similar lines[rcount].ltindex flag. add a BS 32767 bits test. This was not the problem. 2018-05-20 Reini Urban bits_test: add r2004 CMC test and fix a stack-overflow, detected by asan smoke: add python paths on darwin. no system libxml2, only via macports 2018-05-20 Reini Urban man: fix --version output for dwgrewrite to help help2man help2man: can't get `--version' info from ./dwgrewrite Try `--no-discard-stderr' if option outputs to stderr 2018-05-19 Reini Urban encode: write empty null_handle and simplify common_entity_handle_data.spec: use spec.h common_entity_handle_data.spec: set isbylayerlt dwg_encode_handleref: resolve handle codes dwgrewrite: set --verbose dwg.opts and print the objref object fields again only with -v4 (HANDLE) or higher. decode: skip TRACE with FIELD_TF, FIELD_TFF only log the (overlong) value at the INSANE level encode: fix object size calculation no Wrong object size: warning anymore encode: fix object handle wrote the wrong handle for each object free: free class->dxfname_u also fix bits, enable more testcases/bits_test's fix bit_write_DD case BB=3. fix bit_read_L, bit_write_L (unused). add _H testcases, and many more. 2018-05-18 Reini Urban encode: fixed for r2000 write the object CRC (same seed). dwgrewrite works now for sample_2000.dwg 2018-05-18 Reini Urban encode: fix bitsize no duplicate bitsize fields on Dwg_Object_Object and Dwg_Object, only one. patch encode bitsize after the object/entity was written. we cannot assume that the encode user knows the bitsize, hence write the actual bitsize. use a temp. obj->size*8 value. size change would be at 0x7fff. so far we ignore that. 2018-05-17 Reini Urban xmlsuite: make it python3 compatible tested ok with python 2.7 and 3.6. smoke with --enable-python=python3.6m fix m4/ax_python_devel.m4 for macports which uses the --enable-framework=/opt/local/Library/Frameworks prefix, which is not honored in the -L prefixes. add a couple of echos 2018-05-16 Reini Urban man: make help2man optional we ship the .1 files, and help2man is not on all systems. only needed to regen the man files. e.g. cygwin does not have it. add it there. dxf: add BLOCKS now only a few minor DXF issues are remaining dxf: add ENTITIES and OBJECTS 2018-05-15 Reini Urban DEBUG_HERE: silence wrong uninit warning free: add dwg_obj_is_control function the tables have copies in dwg 2018-05-15 Reini Urban dwg, out_dxf: fix TABLES as expected we have to copy the CONTROL object fields to avoid corruption by realloc. also rename SHAPEFILE handles field to styles. 2018-05-15 Reini Urban dwg, out_dxf: add TABLES and add the table control links to the dwg struct. note that these links might be corrupted if objects are realloced. if so then we need to copy struct fields. remove dwg->num_layers and harmonize with the other tables. 2018-05-15 Reini Urban dwg2dxf --help: add r2007, r2010, r2013 the dxf writer can do that already, i.e. will do that add dist_man1_MANS we distribute the man1 pages. but no man3, just the info. dsymutil: add noinst_PROGRAMS also README: Update dwg2ps is not so good to be advertised in the README dwg2ps: fix compiler warning -Wdeclaration-after-statement configure: allow CFLAGS overrides e.g. for pslib CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib 2018-05-15 Reini Urban scan-build: don't wait scan-build -V calls scan-view which waits until we are finished looking at it in the browser. put this into the background, we need to kill scan-view later (a python process). without make just waits here, but we don't want to test this via smoke.sh 2018-05-15 Reini Urban dwgwrite: improve reader format detection which reader: either manual -I --format argument, or by the extension of the input file. fix build-aux/smoke.sh syntax error with CC, darwin only 2018-05-14 Reini Urban dwg_resolve_handle* not public yet move out of dwg.h, it doesn't look stable enough. but add a new dwg_ref_get_object_relative to find a relative object from an handle and base object dwg2ps: add arc and circle 2018-05-14 Reini Urban extend dwg_ref_get_object to actually search for the object via absolute_ref, not just the cached obj. use it for polyline vertices in dwg2ps. move the handle resolvers from private decode to the public dwg. 2018-05-14 Reini Urban dwgwrite: use dxf_read_file which decides upon ascii or binary, or dwg_read_dxfb directly with the .dxfb extension 2018-05-14 Reini Urban move dxf reading from dxf2dwg to in_dxf from the sample into the library. dwgwrite will need that also, and users also. note that the reading implementation is not yet written. it's mere copy of the writers (ascii and binary). the reader needs to account for unsorted order of items. and add a few const's 2018-05-13 Reini Urban improve gcov from 1% to 35% the true library coverage is about 75%, but we are getting closer. alive.test: dash fixes, empty $problems 115: [: =: unexpected operator and more. windows: skip dwgrewrite tests on mingw. killall does not work there configure: add --disable-python and work on --enable-python=python3.6 smoke: more compilers 2018-05-12 Reini Urban HACKING: update deps, tips, dates dwg_api.h: no double decl of dwg_object_ref only clang-4 -std=c99 complained POSIX 2008 for strdup, and add M_PI several stricter compilers don't have strdup nor M_PI. define _POSIX_C_SOURCE to 200809L This fixes e.g. clang-4 -std=c99 add smoke.sh for darwin/linux and probe for basename, which fails on my arm cross. use POSIX libgen.h before string.h with the GNU extension of basename. without basename fall back to fullpath for the outfile. 2018-05-11 Reini Urban various -Wall fixes detected by the arm cross-compiler, which is a bit stricter dwg2svg2: fix a few warnings from clang -Weverything json: add NOCOMMA, object fields looks pretty good now, almost correct. NOCOMMA erases the last ,\n of an array/hash 2018-05-11 Reini Urban configure: change setenv warning tracing works now even without setenv(). Just --enable-trace will not work as expected. -v1 does though. Also note that we currently need a gmake on BSD's 2018-05-11 Reini Urban appveyor: re-enable --enable-write we now kill hanging dwgrewrite processes dxf: fix windows cast warning dxf: unify into header_variables_dxf.spec now just some more sections are missing. also add some rudimentary dxf content testing. add AutoCAD native and libdxfrw dxf's to compare against. (no theiga yet) dxf: harmonize ascii/binary types more and simplify spec.h. add a special DXF (out) block travis: add suggested texlive suggested by verbose distcheck. distcheck passes now on travis, so en-arm it. travis: verbose DISTCHECK now it fails with make dvi travis: add swig work over all authors and copyright years 2018-05-10 Reini Urban encode: harmonize handle logging appveyor: clean tag release names don't double add the prefix and suffix. stay with the simple tags, ie. the build number. the zip has the proper name. appveyor: disable write it started segfaulting, since we improved it. enable it, when it starts becoming more stable. 2018-05-10 Reini Urban encode: add RESET_VER cur_ver should be reset after after SINCE/... version check block, otherwise e.g. handles are not printed. We are stuck with this syntax without the block in the macro, so try to add these RESET_VER wherever it is missing. 2018-05-10 Reini Urban encode: fix HANDLE reset wrong cur_ver to allow printing handles encode: harmonize HANDLE tracing and fix 2 minor issues: reactors have dxf code -5. print the type as decode dxf: more dxf codes, add dxf_codepage() add dxf codes for FIELD and GEODATA. support codepage 29: ANSI_1251 dxfb: more types and harmonize the goal should be a header_vars_dxfout.spec, with typed fields, like HEADER_RC. but maybe it can even serve for dxfin also, looping over all available names. 2018-05-09 Reini Urban encode: fix objects advance to the next object, don't reset to start start address. previously objects were overwriting each other. calculate size, and adjust if wrong. users cannot be expected to write both sizes, byte and bits correctly. Now only bit_write_handle is broken, and several object sizes are off. 2018-05-09 Reini Urban encode: simplify bit_write_MS this is just a very simple RLE encoded int, with the highest bit announcing a further short. in this case 1 or 2 shorts. 2018-05-08 Reini Urban encode: ensure chain size when writing objects dxf: more header vars fix colors, fix MLINESTYLE handle name to entry_name for consistency, rename the HEADER_VAR and HANDLE_VALUE macros. Fix decode WE_CAN only error message we can only decode version R13-R2007 (code: AC1012-AC1021) DWG files. was -R2004 decode: improve version file-magic check error with Invalid DWG, magic: %s or Invalid or unimplemented DWG version code %s dxf: add common_entity_handle_data and few more minor improvements. only output dxf codes != 0. still a lot todo. json: indent arrays and hashes add abstractions, also useful later for YAML. dxf: add and fix more 2007+ vars and fix some 2004+ dxf codes. add SHADOWPLANELOCATION and REALWORLDSCALE unknowns. 2018-05-08 Reini Urban dxf: add REQUIREDVERSIONS as 160 this is a DXF header value. also convert ucs-2 CLASS strings down to ascii for DXF. TODO: decode header variable LASTSAVEDBY 2010+ 2018-05-08 Reini Urban alive.test: simplify dwgrewrite handling This does not need an extra argument anymore. rename fmt_ to out_ corresponding to the needed in_ readers: json, dxf, dxfb 2018-05-07 Reini Urban add dwgwrite skeleton corresponding to dwgread. need format readers, not writers. dwg_read_json(), dwg_read_dxf(), dwg_read_dxfb() doc: fix Decoding API example add manual, gendocs.sh from gnulib (GPLv3). just remove a wrong htmlarg setting. dxf: DWGCODEPAGE is since r10 probe for strcasecmp header use AX_INCLUDE_STRCASECMP from autoconf-archive. dwg2dxf: use fmt_dxf{,b} 2018-05-07 Reini Urban dwgread: add the 3 output formats and add -o outfile support and regen the man pages. If this turns out nice, add the other output formats also: YAML, XML, PS, SVG, ... 2018-05-07 Reini Urban add fmt_dxf and fmt_dxfb also 2018-05-07 Reini Urban json: start with -O fmt JSON WIP various formatter output modules: -O json,yaml,xml,dxf for dwgread. maybe even ps and svg. so we will need only a dwgread and dwgwrite, not any other helpers. add fmt_json. for now they all print to stdout as stream, but dwg2dxf might want to print to a fh, because this construct outfile from infile. The --format arg can also serve for dwggrep as output format for each found entity. 2018-05-04 Reini Urban trace: init 2007 loglevel for 2010+ otherwise some 2007 helper functions, like section_string_stream and obj_string_stream do no logging. loglevel is module specific, and those helpers don't have dwg as arg. TODO: update TODO testcases: fix more wrong format types ubsan: fix signed integer overflow for the hash calc use an unsigned rseed. eed: fix asan write error when adding the ucs-2 string delimiter it will write 2 byte, past the allocated bufsize. hence alloc size+2 to ensure delimited unicode strings. and then we can skip writing the last 0, as we already used calloc with size+2. trace: enable loglevel via -v in encode, decode and free entry points examples: add -v[0-9] support work over copyright headers, add one AUTHOR fix the years, add missing authors. trace: independent loglevel per dwg.opts pass through the loglevel/--verbosity without --enable-trace, resp. without setenv() 2018-05-02 Reini Urban read_2004_section_classes: wrong max_num type add build-aux/appveyor-deploy.bat deploy either a tagged commit or nightly branch, not both appveyor: add nightly deployments for master branch changes. see https://github.com/rurban/libredwg/releases windows: add .appveyor.yml deploy as zip windows: harmonize wchar_t logging improve native wchar_t as UCS-2 support (windows), printing it natively Makefile.am: remove check-wine make check can handle wine already, check-wine was broken for a while programs: fix wine typo the additional ) caused run 'dwgrewrite.exe)' example_2000 less logging: adjust levels a bit log less important info with higher levels. add LOG_TF for fixed text for arbitrary levels, use if for binary fixed blobs with INSANE, not TRACE. log @ positions with level 4 HANDLE. 2018-05-02 Reini Urban check-dwg*: use -v3, not -v4 avoid logging large binary blobs, esp. with unsupported versions. some example logs are >2GB no double .PHONY targets 2018-05-02 Reini Urban check-dwg*: use -v3, not -v4 avoid logging large binary blobs, esp. with unsupported versions. some example logs are >2GB 2018-05-01 Reini Urban 2007: enable 2007 decoding, now supported. enable tests, disarm the decode_R2007 IS_RELEASE check, remove the warning, fix the docs. 2018-05-01 Reini Urban 2010: prepare 2010 classes, fix 2007 on top of the 2004 section format. copy over the logic from 2017. harmonizes classes, and fixes reading the last class (max_num) for 2007+. This fixed reading most 2007 DWGs 2018-05-01 Reini Urban 2010: prepare decode_header_variables add bitsize_hi, calc. bitsize. separate the 3 streams for 2010. can parse now until the individual object bitsizes. (still 0) 2007: change decode warning message handle and string streams are now solved. start working on the remaining bugs 2018-04-30 Reini Urban 2007: fix xrefindex_plus1 ODA doc bug xrefdep is before xrefindex_plus1 since r2007+, not r2010+ rename table flag bit 7 _64_flag to xrefref referenced external reference, block code 70, bit 7 (64) 2018-04-29 Reini Urban 2007: better hdlpos calculation no -42 offset. start before reading the type after the size. then the handle position naturally aligns. add a Dwg_Object address field. The r2010 bitsize derives from the obj->size. 2018-04-28 Reini Urban 2007: adjust hdlpos by -42 found out error experimentally. Most r2007 objects can now be read, just a few remaining errors. unify START_HANDLE_STREAM esp. it is r2007+ only dwg.spec: cosmetics LOG_ERROR for invalid DICTIONARY.numitems 2007: add FIELD_VECTOR_T vcount index as has_strings. hdlpos should be always right. some objects seem to ignore has_strings, like ENDBLK 2018-04-28 Reini Urban 2007: fix obj string stream calc fix for negative advance. use one more byte offset to the back. data_size is now correct. check bit_advance_position also for underflow < 0 TODO: with no strings don't try to read strings, set them to NULL. (MLINESTYLE) 2018-04-28 Reini Urban 2007: LAYER set flag bits 2007+ reads only a RS, set the bits for older releases. also add some string stream debugging code 2010: use LAYER handles r2010+ 2007: use COMMON_TABLE_FLAGS entry_name FIELD_T, not FIELD_TV 2018-04-27 Reini Urban 2007: undo START_HANDLE_STREAM has_strings offset 2018-04-27 Reini Urban 2007: fix the hdlpos offset and ignore the still wrong has_string bit. Now the handle_stream and string_stream offsets are correct, just the string stream length and bit are wrong. Thus ignore the has_string bit for now in START_HANDLE_STREAM Fixes many 2007 objects. 2018-04-27 Reini Urban 2007: add FIELD_VECTOR_T for 2007 array of TU texts. Fixes DICTIONARY with r2007. read/write: allow hard- and symlinks not just regular files. just on windows with mingw S_ISLNK is undefined. and some minor improvements on write: binary, rename vars. programs: crash on notexisting file when returning early from dwg_read_file (e.g. not found, not readable) we still call dwg_free, which needs the pointers to be NULLed. 2007: rename some VIEWPORT fields def_lighting_type -> default_lighting_type use_def_lights -> use_default_lights ambient_light_color -> ambient_color 2007: complete VIEW and VPORT spec fields rename Dwg_Color byte to flag HACKING: link to CONTRIBUTING and USING_FOREIGN_CODE USING_FOREIGN_CODE: add incompatible licenses also. From https://www.gnu.org/licenses/license-list.en.html add USING_FOREIGN_CODE answering the question which code can be used in LibreDWG, e.g. a reed-solomon library update docs 2018-04-27 Reini Urban add manpages and option handling option handling is minimal, position sensitive. not using getopt_long() yet. used help2man to create the initial manpages. (in sync) rename dwg_ps program to dwg2ps for consistency 2018-04-27 Reini Urban noinst_PROGRAMS: dwg2dxf dxf2dwg these are not yet ready. we are targettting an early alpha release, and these will not be ready for that TODO: more TODO leak: free the sections chain sections is the root, section just the current element in the linked list. only in the unlikely case of out of memory. leak: free the xdata chain and not just the last element, in case of out of memory (very unlikely). 2018-04-26 Reini Urban programs: default to LIBREDWG_TRACE 1 probe for setenv and use it. this is only failing on mingw. print the error message when failing. Fixes Bugs #31867, #35110, #46175 leak: set DWG_SUPERTYPE_UNKNOWN to avoid double-free of eed data. this is one big chunk only. free eed.raw only on size, otherwise it's a continuation with data only. leak: fix double-free of LAYOUT eed leak: free the eed data and COMMON_ENTITY_HANDLE_DATA: all the common handles, reactors. analyzer: initialize dwg->header.version Logic error Result of operation is garbage or undefined programs/dxf2dwg.c dwg_read_dxf analyzer: fix memory leaks analyzer: remove dead initialization dwg_encode_common_entity_handle_data does not need dwg (yet). 2018-04-26 Reini Urban analyzer: fix clang-analyzer warnings using the recent scan-build target. Allocator sizeof operand mismatch (wrong malloc casts) Branch condition evaluates to a garbage value (uninitialized obj_dat) Undefined allocation of 0 bytes (CERT MEM04-C; CWE-131) (for counts=0) 2018-04-26 Reini Urban pre-R13: start decoding entities WIP move the common pre-R13 entity fields to Dwg_Object_Entity and add a spec-local _ent for this. add a common decode_entity_preR13() decoder before the entity-specific handlers. 70% done. decode_preR13_entities: add the entity loop. missing: check DIMENSION opts field for the type. dwg.spec: TODO ATTRIB/ATTDEF, add VERTEX_2D, POLYLINE_2D add R11OPTS(n) macro silence r11 compilation warnings use proper field casts for r11 2018-04-26 Reini Urban policy: add #ifndef IS_RELEASE checks abort on unsupported DWG versions to avoid segv on released packages. logic: if a .git directory is present it is not a release. also add a new scan-build target, using clang's static analyzer clang-analyzer. 2018-04-26 Reini Urban add CONTRIBUTING, adjust TODO copy CONTRIBUTING from the GCC project and adjust it. Esp. important for Legal Prerequisites. This is an official and important GNU package, with ownership assigned to the FSF, to able to protect us from legal threats. adjust TODO, README and README-alpha. Mention that unreleased downloads of the library will crash as it will try to decode unsupported DWG versions. Released downloads will rather abort then. 2018-04-25 Pero Brbora unit-testing: Prevent segfault on error Closes Savannah #8628 2018-04-25 Reini Urban README: updates 2018-04-24 Reini Urban pre-R13: fix STYLE add bigfont_name field pre-R13 DIMSTYLE vars just the DIMBLK_T texts are unsure, and one unknown RC var not in DXF: DIMUPT probably pre-R13 header vars complete the header vars with DXF counterparts. missing are the handles (i.e. table indices), and texts. 2018-04-23 Reini Urban Improve object tracing Print the type even with loglevel 2, but not much more 2018-04-23 Reini Urban r11: reset tbl->number on failure when we read a non-object table, reset the index so we don't increment it in the next line dwg->num_objects += tbl->number; 2018-04-23 Reini Urban xmlsuite: only process existing DwgTxtFileName protect from skipped dwgs, such as 2004 2007: add klass dxfname_u field and use dxfname as the ASCII variant for comparisons. This fixes reading all the class objects (>500). 2007: fix obj_string_stream The bitsize calculation starts before reading the bitsize. Thus initialize the string stream before reading the bitsize. The bit is then always 0, as objects start at bit offset 0 2007: fix EED code 0 2007 already uses unicode strings in EED 2007: add absolute last_offset tracing and outcomment last_handle for each object (was used for object idx plausibility) 2018-04-23 Reini Urban 2007: limit string data size, read entity bitsize reset the string stream to start at the object offset and limited by the object size. fix reading the entity bitsize in dwg_decode_entity: R_2000 - R_2004 -> R_2000 - R_2010. 2018-04-20 Reini Urban harmonize Num Objects tracing also for r2007 auxheader.spec: convert 20x unknown_rc RC to FIELD_TFF for more pleasant logging LOG_TRACE_TU: harmonize with logging of TV don't typos start separating encode version support add a separate encode_preR13(), but not for the other versions. they are all basically the same, just the sections maps are different. dwg_decode(), dwg_encode() harmonize the two main entry points. rename dwg_decode_data() to dwg_decode(), rename dwg_encode_chains() to dwg_encode() comment for dwg_encode_chains refactor version specific and rename to dwg_encode_data() 2010: add BOT type use the 2004 format. bitcoded object type: single or double byte rename APPID_CONTROL->num_apps to num_entries for consistency with the other table control objects. abstract bit_set_position and a new bit_position getter 2018-04-18 Reini Urban xmlsuite: skip 2007+ so far 2007: more handle stream work now almost works. we need to set the handle stream to the end of the object: pos+bitsize = hdlpos after the has_strings bit. 2018-04-16 Reini Urban name unknown DIMSTYLE_CONTROL vars morehandles undo <=2007 parenthandle object parenthandles appear also in r2010. The pointer to the control object. pack _encrypted_section_header also is wrong with some compiler settings, e.g. asan. replace FIELD_VECTOR RC with FIELD_TF esp. for tighter logging. array of bytes => fixed length text. WIP more 2007 handle stream not for entities yet. there we don't have a bitsize. initialize hdlpos after reading the object bitsize. before 2007 hdl_dat is just the same as dat, ditto str_dat. str_dat is a copy then because strings are interleaved. hdl_dat just needs one advance, because the handles are only at the end. 2018-04-15 Reini Urban sprintf %ls for cygwin warning: passing argument 2 of fprintf from incompatible pointer type [-Wincompatible-pointer-types] LOG_TEXT_UNICODE(TRACE, (BITCODE_TU)wstr) 2007: and WIP the handle stream 2018-04-14 Reini Urban WIP 2007: start working on 2007 object strings don't error on invalid handles (still invalid obj handle stream), start with a few 2007 strings 2004: fix Data Section access the right r2004_header.section_info_id. e.g. 19 => index 16. 19 would be out of bounds fix r11 free empty class r11 has no classes at all, but tried to deref them 2007: improve error handling when get_page or read_pages_map fails fix decompress_r2007: allow length 0 This is basically a LZ77 decompressor, where the case length=0 is allowed. whitespace cleanup decode.c M-x whitespace-mode whitespace cleanup decode_r2007.c M-x whitespace-mode add FIELD_TFF type, pre-allocated fixed string which merely makes for better logging. use bit_read_fixed helper for reading into already allocated fixed length string more section_handles harmonizations simplify 2004/2007 section_handles and harmonize. 2007: WIP start reading objects and handles 2007: update TODO plan merge decode_r2007 with the 2004 decoder, it is the same. more 2007 harmonization rename num_descriptions to num_infos, it is the section_info count. move read_2007_section_objects into read_2007_section_handles, same as with 2004. minor 2004+ section simplifications no logical changes 2007: more sections handles and objects 2018-04-14 Reini Urban r2007 header_variables HANDSEED is not read from the handle stream, but the data stream. PUCSORTHOREF is wrong. separate obj_string_stream and section_string_stream: SECTION_STRING_STREAM got a prepared str_hdl already, START_STRING_STREAM calcs the stream pos from the obj->bitsize. encoding >= r2007 not yet started (need to calc. handle and string stream offsets) * bits.c,h (bit_set_position): added, set absolute 2018-04-14 Reini Urban add separate handle stream for r2007+ before R2007 those two streams, dat and hdl_dat are the same. but no extra string stream yet. we handle that in the dwg.spec extra, locally. 2018-04-14 Reini Urban decode 2007 string streams for now switch dat back and forth, but we really should provide two streams: dat and str_dat for easier dwg.spec integration. And we'll also need a third handle stream, hdl_dat. See the next commit. 2018-04-11 Reini Urban WIP read_2007_section_classes missing: string stream. change the section lookup by type, not hashcode. it should be the same is with 2004 really. TODO merge the code base. 2018-04-11 Reini Urban add r2004+ dwg_section_type resolve the section wname to the enum DWG_SECTION_TYPE, which we need later. to lookup the header, classes, objects sections by index, not by name. do the same for preR13 and R13 section types (also as enum). 2018-04-10 Reini Urban start encode the r2004 Section Page Map Add the 5 r2004 section fields to the dwg->r2004_header and Dwg_Section. simplify section maps massively, no system_section union needed. Add native LE read/write bits for RL (yet unneeded). 2018-04-09 Reini Urban 2018 fix for MLINESTYLE add 2018 test-data DWGs and matching DXFs The 2013 variants saved as 2018. Fix programs CC warnings with WARN_CFLAGS classes >= 2007 add the missing 2007 class-map fields. xmlsuite: write into builddir not into srcdir, which could be read-only. e.g. make distcheck HACKING: add macports python move public headers into include/ 2018-04-08 Reini Urban add HAVE_NATIVE_WCHAR2 We can only use wchar.h when on Windows with a sizeof 2. On unix wchar_t is a 4-byte UTF-32. How to handle these? Use native wchar_t internally and convert when reading/writing? add ctype.h probe fix eed packed struct some gccs add intermediate bytes into the Eed_Data struct, esp. mingw. 2018-04-07 Reini Urban fix wrong encode class checks fix -Wsign-compare use bits _TF functions for larger strings/raw data. esp. for later conversion to FIELD_TF and LOG_TRACE_TF. eed rewrite EED are really a stream of size+app-handle + sequence of app-specific code+value pairs, not just one code+value per handle. So add a new eed struct per code+value pair, and leave the size empty of subsequent eeds, and re-use the handle. 2018-04-02 Reini Urban fixed some r14 second header parsing adjust for num_sections, which now actually matches the documentation more TODO Merge branch 'dxf' into work separate examples and programs. many improvements and fixes, esp. some objects, memory leaks and eed. Update TODO for the finished dxf branch fix get_first_owned_object with no BLOCK_HEADER entities, e.g. empty paperspace. fix MLEADERSTYLE eed wrong usage of index i, used twice, nested. rename the inner appid loop to j, the outer eed loop to idx. more auxheader: still debugging add some helpers: DEBUG_HERE() and LOG_TRACE_TF (fixed string) Makefile.am: fix check-dwg targets free: add dwg_free_handleref where we lookup the handle in the global list of refs and delete it there also. also free the reactors, defer freeing BLOCK_CONTROL, and set a freed obj->type to DWG_TYPE_FREED, to skip double-frees Fix reamining warnings proper casts for preR13 types, warp TODO objects into ifdef DEBUG_ change IMAGE.clip_mode from BS to B ?? de-arm CRC check allow failing CRCs, just log the error 2018-04-02 Reini Urban add dwg_encode_xdata and dwg_free_xdata and enhance the xdata linked-list variant to r2007 unicode strings. simplify the mess a bit. XRECORD: write and free the objid_handles free the object_ref array. 2018-04-02 Reini Urban add check-dwg-valgrind free: dup klass->dxfname because freeing an object could free the dxfname also. and some cases are unhandled. VISUALSTYLE tested ok test VISUALSTYLE harmonize defined but disabled classes CELLSTYLEMAP also. fix more gcc-7 warnings -Wint-in-bool-context: compute the TABLE field num_cells. we use it twice. -Wsign-compare in some eed DEBUG sanity checks build: document missing check-valgrind for the alive.test hack. switch to a normal runtest env, which does have valgrind support change LAYER.color_rs from RS to signed short to check for negative colors DEBUG_MULTILEADER all 4 actions decode/encode/print/free must be consistent if to run the handler or not. fixed 2004_Leader with empty BLOCK_HEADER->entities[0] with dwg2SVG 2018-04-02 Reini Urban .gitignore: a few more private files 2018-04-02 Reini Urban fix MLEADERSTYLE is_new_format add global dwg->appid_control, a list of all registered apps. when an MLEADERSTYLE eed handle points to a ACAD_MLEADERVER APPID, then use the new MLEADERSTYLE format (because it was imported from a newer version). Fixes the text_always_left bit offset. add dwg_resolve_handleref helper, a part of the handle decoder. rename MLEADER to MULTILEADER, the dxf really has the MULTILEADER name, libdwg uses it also. 2018-04-02 Reini Urban rename dxfname MLEADER to MULTILEADER but keep our object definition the same name as in the docs. unlike libdwg. also: SCALE has now enough coverage. 2018-04-02 Reini Urban remov -lm dependency use our own bit_nan() bit_read_BD: fix 64bit stackoverflow use int32_t, not long int to create nan. we still avoid to link against libm, even the dwg_api should not do anymore. second_header: fix sections overflow Leader_2000 has 6 sections there, not just 4 alive.test: dwgbmp Leader_2004 will always fail because it has no embedded picture and it then returns -1 decode: fix ubsan problems avoid *((uint64_t*)ptr) alignment problems (eg. sse). crc code: use unsigned properly typed rseed to handle overflows free: use default loglevel ERROR eed: do away with pesky valgrind overflows no idea why it still overflowed refactor eed make a raw copy, and also read into the eed union. separate programs dir for bin_PROGRAMS. enhance alive.test to test more DWGs 2018-04-02 Reini Urban free: add some more HANDLE_VECTOR, FIELD_VECTOR (esp. for TV), second_header.handlers, FIELD_HANDLE (the dwg_object_ref). zero the dwg struct on dwg_read_file() (in case of early free). dwg_encode_chains: initialize section_address (detected with -O2) 2018-04-02 Reini Urban dwg_bmp: protect from empty picture size fixes dwgbmp Leader_2004.dwg 2018-03-31 Reini Urban fix make distcheck: add dim_common.exp and src/free.h. avoid duplicate loglevel symbol. Fix r2000 second header r2000 has 5 chars before the sections, not 4 as before. Merge commit 'afa21732aa095f6a109821e561092748ae851d2e' into work finish the API revamp: unit-tests fix up the dimension unit tests for the new DIMENSION API. replace elevation_ecs11 by elevation. add new DIMENSION_common subentity for the API only, to save a lot of functions adjust dim testcases disable CELLSTYLEMAP, fix MTEXT style handle FIELD_G_TRACE: print the dxf code numerically. WIP cleanup the API and more 2018-03-31 Reini Urban WIP more dxf codes: REPEAT_4, macrofy remove _Entity/_Object from structs, which are not entities, objects, just parts thereof. macrofy common field accessors: Table_Value(value) 20.4.99 for FIELD and TABLE Cell_Style_Fields(sty) 20.4.101.4 for TABLE, TABLECONTENT and CELLSTYLEMAP Content_Format(fmt) 20.4.101.3 for TABLECONTENT and Cell_Style_Field 2018-03-31 Reini Urban WIP more dxf codes: almost done add END_REPEAT for free. fixup some types and errors. WIP more dxf codes mostly HATCH, MLEADER, TABLE, ... add VECTOR_FREE at the end of REPEAT 2018-03-30 Reini Urban WIP more dxf codes, and finish more objects dwg_decode_handleref_with_code: handle offset pointer codes. WIP more dxf codes and some typos and more documented objects. esp. the new tables objects. WIP add dxf codes to all fields and integrate more r11 tables into dwg.spec merge UCSICON_0+1 B to UCSICON BB 2018-03-29 Reini Urban typo: default_lightining_type => default_lightning_type r11: fix free empty objects dwg_free_LAYOUT: obj->type == obj->parent->layout_number is not true there. 2018-03-29 Reini Urban dwg.spec: start adding r11 tables to the spec make each FIELD a statement, to allow bracket less single fields if statements. 3 lines => 1 line. but not for SINCE/UNTIL, since this needs to set cur_ver before. add IF_ENCODE_FROM_PRE_R13 r11 defaults, flags <=> bits, also needed for dxf. 2018-03-29 Reini Urban dwg.spec: reformat no functional changes, whitespace and rearrange FIELD macros only. r11: implement the tables add a BITCODE_TF fixed width text type. fixed a few typos: VIEW.lens_legth => lens_length MLEADER: ctx.text_heigth => ctx.text_height 2018-03-28 Reini Urban more r11: outline all tables/sections read now until the end add TIMEBLL type, more r11 work add a special TDCREATE type to simplify dxf handling. add Dwg_Section_Type_r11 enum, rename table processing to section, because they have similar structure. 2007: add LOG_TEXT_UNICODE, LIBREDWG_TRACE honor LIBREDWG_TRACE on decode_2007. beautify the log output a bit. we can now print UCS-2 on unix platforms via LOG_TEXT_UNICODE update TODO R2004 decoding done, start with R2007 spec: add more unknown templates and embed more parenthandle < 2007 2018-03-27 Reini Urban fix 2004 Common Entity Data layer layer is only for 2000, not 2004. add shadow handle: 2007+ fixes reading all 2004 dwgs fix HATCH num_boundary_handles only count num_boundary_handles on decoder, esp. not when printing it. calloc all REPEAT objects to zero-init all counters. HATCH: rename z_coord to elevation harmonize to parenthandle from XRECORD->parent and lots of parent_handle. more objects and specs complete the r2010+ optional xrefindex_plus1 for all tables, add WIPEOUTVARIABLE, add entity_HATCH_DefLine, optional null_handle 2010+, SHAPEFILE_CONTROL: num_entries BS => BL. 2018-03-27 Reini Urban more 2007 specs: go over all objects type all FIELDS: FIELD(name,type) => FIELD_type(name) some entities have no post common entity data handles 2007+ DICTIONARY: no itemhandles BL, read handles later, LEADER: associated_annotation since r13, not 14. BLOCK_CONTROL: num_entries BS => BL, paper_space <= 2007 BLOCK_HEADER: 2010+ xrefindex_plus1, rename preview_data fields LAYER_CONTROL: num_entries BS => BL, null_handle <= 2007 LAYER: 2010+ xrefindex_plus1 2018-03-27 Reini Urban fix 2004 header_vars current_viewport_entity_header is only r13-r2000. read_2004_compressed_section: better logging and error handling. free the temp. decompression buffer. fix ENT_REACTORS encode and fix tracelevel for decode_object/entity: honor LOG_TRACE level. silence free DIMSTYLE some FIELD_CAST values were printed on free examples: don't leak suffix filename_out and add one missing dwg_free() dwgrewrite: warn when num_objects differ the previous re-read just checks for a valid structure, not if really all objects were written. suffix: fix . handling in ext when the ext already contains a dot don't add another one encode: write empty strings NULL chains. Not yet NULL handles 2004: second_header since r2004 is read partially. the sections map and handlers is handled elsewhere. decode_R2004: logging cosmetics 2018-03-27 Reini Urban fix decompress_R2004_section assert src may be equal to decomp. fixes reading 2004/Leader_2004.dwg and 2004/Drawing_2004.dwg all my r11-r2004 dwgs can now be decoded. 2018-03-27 Reini Urban Add some of my test DWGs and DXFs Produced with my evaluation copy of AutoCAD 2013 for MAC and some free library blocks from the internet. Add a LEADER, associate MLEADER, a HATCH filled with an image, and parametric constraints objects. 2018-03-27 Reini Urban add MLEADER and OBJECTCONTEXTDATA untested. just taken from the spec. add BITCODE_TU UCS-2 DWGCHAR not suore yet if the BITCODE_TU is zero-delimited nor not. 2018-03-27 Reini Urban Second header: improve, esp. r14 sanitize second_header, via proper fields. esp. the encoder was wrong. parsers all of my r2000 and r14 samples. 2018-03-27 Reini Urban more common 2010,2013 fields handlestream_size, has_ds_binary_data tune free calls check also the size, not just the pointer. free only once, not some classes twice, such as CELLSTYLEMAP, VBA_PROJECT honor the LIBREDWG_TRACE trace var, to display the free'd object pointers. fix EED padding and realloc use (i+1) * padding is normal, not something to warn about. 2018-03-27 Reini Urban add free dwg.spec callbacks use the spec to free each field, similar to print. result: from 23k down to 20k definitely lost. Missing: XRECORD xdata ResBuf, DICTIONARY handles, common entity data handles. 2018-03-27 Reini Urban bits: protect from overflow and fix bit overflow, properly wrap around disable MLEADERSTYLE wrong EED offset add FIELDLIST, MLEADERSTYLE this is still WIP. the first MLEADERSTYLE line_type handle is wrong. add SCALE, VBA_PROJECT objects VBA_PROJECT still untested. SCALE looks ok restart unhandled/untested class objects When a variable-type object is unknown/untested, restart it to the prev. known address and read in the raw bytes from there again. Fixes offset problems with testing some new objects: VBA_PROJECT, CELLSTYLEMAP which interestingly also is in some R2000 (AC1015) files from the internet. decode-only so far. work on r14 stability skip CRC check error with num_sections!=5, fix DICTIONARYWDLFT.unknown_r14 to RL (probably some combination of RS,RC,RC) r14 DICTIONARY.unknown_r14 is the hard_owner flag. 2018-03-27 Reini Urban dwg_encode_variable_type sync with dwg_decode_variable_type and let untested classes be also encoded as UNKNOWN_OBJ 2018-03-27 Reini Urban add check-dwg target test all test-data DWG files with dwgread fix gcov targets we are now at 23.9% 2018-03-27 Reini Urban finish UNKNOWN_OBJ add the encode and print parts. we did for encode after all. TODO: we could store the address before trying untested objects and reset if for the UNKNOWN_OBJ. that way we can look at the union values and still be safe. 2018-03-27 Reini Urban WIP UNKNOWN_OBJ use dwg_decode_object/entity for eed, reactors, xdic, even for unknown objects/entities. So far all of them are class objects. store the raw bytes as raw field vector, TODO /8 slack if bitsize % 8. This fixes the version dependent handling of bitsize, eed, reactors, xdic, and should now handle all of the MATERIAL, SCALE, ... objects. 2018-03-27 Reini Urban fortify dwg_free, document clearing all of Dwg_Data initialize all critical Dwg_Data pointers and counters, so that dwg_free will not touch uninitialized data. document that all incoming dwg data will be cleared in dwg_decode_data and dwg_read_file. 2018-03-27 Reini Urban more DXF adjustments rename VPORT fields to its DXF names. rename Class fields: proxyflag. item_class_id really is named Is-an-entity flag: 1f2 for entity, 1f3 for object. See http://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf more DXF adjustments WIREFRAME is not a headervar, DISPSILH is probably meant. rename OBSCUREDCOLOR back to DXF OBSCOLOR, likewise OBSCUREDLTYPE => OBSLTYPE, IDEXCTL => INDEXCTL. dxf2dwg: fix r11-r2000 and add some more missing header_variables_r11 decode_preR13 WIP added some prelim. header_variables_r11.spec, not bit-encoded, just raw. add the raw decoding layout, as found out 1995. Update TODO doc: add Examples and more add dxf2dwg.c WIP TODO: read DXF, code/name pairs, and look them up in one of the specs. 2018-03-27 Reini Urban add dwg_version_as similar to the acad saveas options, to map the the --as-rVER option to our internal Dwg_Version_Type, e.g. R_2000. * src/common.c, src/common.h (dwg_version_as): added. * src/common.h (Dwg_Version_Type): added R_INVALID (similar to R_BEFORE). * examples/dwg2dxf.c, examples/dwgrewrite.c: use dwg_version_as. 2018-03-27 Reini Urban add R_12, the same as R_11 but more prominent AC1009 is mostly referenced as Saveas R 12 format, not R 11. So we do support R_12, with the same AC1009 DWG. 2018-03-27 Reini Urban more dwg2dxf work add some old defaults, and pre-r13 vars: HANDLING, paperspace, ... fix option handling a bit 2018-03-27 Reini Urban add ole2frame to unit-testing was skipped add xrecord API and testcase set num_eed in the XRECORD object. TODO: change the linked list into an array, to unify with the generic eed array dwgread: simplify dwg2svg2: 32bit now fixed 2018-03-27 Reini Urban fix 32bit dwg_api dwg_api.o didn't load stdint.h, so had a different size than dwg*.o * src/dwg_api.c: include stdint.h, inttypes.h, fixing 32bit. 2018-03-27 Reini Urban testcases: use DEJATOOL see https://www.gnu.org/software/automake/manual/html_node/DejaGnu-Tests.html and https://www.embecosm.com/appnotes/ean8/ean8-howto-dejagnu-1.0.html * test/Makefile.am: : use DEJATOOL, not RUNTESTDEFAULTFLAGS * test/testcases/Makefile.am: remove unused RUNTESTDEFAULTFLAGS * test/testcases/common.c: remove unused code 2018-03-27 Reini Urban configure: fix AC_MSG_WARN quoting dwg2svg2: more work on 32bit crashes decode_R13_R15: optional section[4] only read the measurement section when appropriate. though in praxis it always is. fixup examples/dwg2SVG.c var initialization, dwg global not on stack. doc: remove dwg_print_object from API it is using the Bit_Chain. But add examples how to iterate over all entities, in model space and paper space. 2018-03-27 Reini Urban add Bit_Chain arg to dwg_print_object and remove it from the global _dwg_struct. move dwg_print_object from public dwg.h to private print.h, because Bit_Chain is not public. The bit_chain field was added with commit b24e5329b3e0ae178bb7162a6a492c0f6313899d Author: Rodrigo Rodrigues da Silva Date: Fri Jan 29 04:43:47 2010 -0200 Added macro created print functions, made some functions private, increased logging trying to fix objectrefs. 2018-03-27 Reini Urban unit-testing: move dwg struct from stack to global on some 32bit systems the stack might be too small for 2500 byte. extend the dwg_api dwg: num_classes, num_objects, num_entities, object[], class[], eed, bitsize. 2018-03-27 Reini Urban dwgbmp: fix use-after-free cannot write the picture from the freed dwg. free the dwg afterwards. darwin: add a dymutil helper target hack, for better symbolization. 2018-03-27 Reini Urban load_dwg: silence unused-params warnings 2018-03-27 Reini Urban more work on dwg_free add dwg_object_free(). protect from double-free the bit_chain by setting bit_chain.size = 0. 2018-03-27 Reini Urban .gitignore: add renamed examples 2018-03-27 Reini Urban rearrange dwg.h rename dwg_ot_layout to layout_number, rename second_header.handlerik to second_header.handler. free the dwg a bit more. the objects and entities are still leaking massively. 2018-03-27 Reini Urban dwg2svg2: use global dwg not stack allocated. printf header after getting the objects. zero-fill the dwg struct data. 2018-03-27 Reini Urban working on 32bit crashes add two helper handles for mspace_block and pspace_block BLOCK_HEADER. zero-fill new objects. TODO: someone, maybe CRC, is overwriting the Dwg_Struct after num_classes, 32bit only. with dwg2svg2 only. CRC = 36953}, num_classes = 4, dwg_class = 0x8153100, num_objects = 61, object = 0x8158398, num_layers = 0, num_entities = 12, num_object_refs = 154, object_ref = 0x8155b78, layer_control = 0x81532a0, mspace_block = 0x8154ff0, pspace_block = 0x8156560, => CRC = 65028}, num_classes = 3086986712, dwg_class = 0xad9f3224, num_objects = 1336173547, object = 0x9059, num_layers = 4, num_entities = 135606528, num_object_refs = 61, object_ref = 0x8158398, layer_control = 0x0, mspace_block = 0xc, pspace_block = 0x9a, CRC ... num_entities is wrong. 2018-03-27 Reini Urban configure: make python optional check for swig, and only then for python. and only then build the python bindings. allow older 1.11.6 automake, e.g. debian wheezy. don't use PKG_CHECK_MODULES, just call if pkg-config. CFLAGS: add -fno-omit-frame-pointer to gcc for better 32bit debugging. 2018-03-27 Reini Urban improve win32 support tested with i686-w64-mingw32 under wine 32bit. still failing test case: dwg2svg2 with both dwgs. DIMTXSTY: fix typo fixes dwg2dxf decode: zero-fill fresh memory use calloc, not malloc, to be on the safe side. 2018-03-27 Reini Urban dwg2dxf headers, rename some header_vars to dxf rename *_{M,P}SPACE vars to the canonical dxf names. e.g. INSBASE_MSPACE => INSBASE, INSBASE_PSPACE => PINSBASE. finished header section. 2018-03-27 Reini Urban add dwg2dxf WIP just the first few header vars yet minor cleanup remove unused Dwg_Data_Type from src/common.h add proper error handling, ... AUTHORS: add myself README: add needed packages calloc entity/object zero-fill fresh entities/objects. initialize Dwg_Object->bitsize, mostly just the object/entity part is initialized dwgrewrite: fix filename_out restore C++ compat use extern "C" extend Dwg_Handle types from char to int. codes can go up to 1000, some even higher. abstract dwg_decode_eed function similar to dwg_decode_xdata for XRECORD. add objid_handles code to XRECORD, decode only dwg.h: add datbyte offset to dwg_object to know the end from start (=datbyte) and bitsize. ChangeLog: formatting unit-testing: more type fixes fix most of the remaining trash code and formatting. 2018-03-27 Reini Urban dwg_ps: fix asan crash obj->tio.entity->entity_mode is not always defined, only for entities. * examples/dwg_ps.c (create_postscript): remove wrong obj->tio.entity->entity_mode check 2018-03-27 Reini Urban add FIELD_CAST several r13-r14 DIM vars have only type RC. store it as BS, and cast it up to BS. detected with clang -Wformat, not with gcc. 2018-03-27 Reini Urban More fields, start with adding dxfgroup FIELDS_G*. Also avoid eed[i] overflows. Avoid ntoh() dependency, add bit_read_RS_LE(). 2018-03-27 Reini Urban cross-compiler support disable python+swig when cross-compiling. disable rpl_malloc replacement, because of AC_CHECK_HEADERS malloc.h. we don't need it, we just want to know if it's needed. add gcov probe and target usage with suffix'ed gcc: CC=gcc-mp-6 ./configure --enable-gcov=gcov-mp-6 make gcov add ole2frame to testcases and export its ENTITY 2018-03-27 Reini Urban xmlsuite: fix compiler warnings and libxml2 insanity they insist on using unsigned char* in their public API, oh my. declare all missing funcs, and a lot more. properly return the exit code. 2018-03-27 Reini Urban dwgbmp: proper error handling add perror calls when fwrite failed. write to stderr. return failing exit code. LOG_{ERROR,WARN}: no duplicate ending \n LOG_{ERROR,WARN} already adds a \n decode: adjust unhandled classes/objects fixup the TODO list, add GROUP and WIPEOUT to the handled classes 2018-03-27 Reini Urban dwg.h: check HAVE_WCHAR_H, fix DIMTAD, DIMZIN type wchar_t is needed for examples, ... rely in HAVE_WCHAR_H. change DIMTAD, DIMZIN decl from RC to BS, as used since r2000. we need the larger type for the common storage. 2018-03-27 Reini Urban testcases/tolerance.c: fix and add extrusion test there was a mixup dwg_api: add missing common entity/object APIs declarations only 2018-03-27 Reini Urban decode: LOG_INFO handles when read not later when the whole EED and more was read. TODO: we already decrypt the raw SAT data. we only might want to parse it into some SAT structures. 2018-03-27 Reini Urban EED done inline the EED char buffers. * configure.ac: probe for wchar.h needed for r2007+ text. * src/dwg.h (Dwg_Eed_Data): inline the buffers, and comment that the integers need to be endian swapped for the API, if they need to be interpreted. They are still in network order. But mostly just dump the raw. Swap the codepage. (Dwg_Eed): Dwg_Eed_Data *data is now a calloc'd pointer, not inlined. * src/bits.h: add , needed for a unit-test. * src/decode.c, src/encode.c: use the changed Dwg_Eed_Data. add length sanity checks and offset deviations. special-case eed_0 strings. 2018-03-27 Reini Urban EED: add dwg_encode_{object,entity} to encode WIP also write common_entity_handle_data, comment out unused objects and the proxy subtype. src compiles now warning free. 2018-03-27 Reini Urban rewrite EED (untested), more common entity support Fix multiple instances of EED. It it either stored as array, but more likely as linked list. Anyway, we need to store it as array of structs, not as linked list. But for sure not as the next EED overwriting the previous. * src/common_entity_handle_data.spec: Add support for more entity fields R_2010+: simplify nolinks, add color_handle, add has_*_visualstyle R_2010+. * src/dwg.h: add Dwg_Eed_Data, Dwg_Eed structs, num_eed + Dwg_Eed *eed in entity and object, add color_handle, *_visualstyle. * src/decode.c (dwg_decode_entity, dwg_decode_object): add num_eed, minor rewrite of eed. add RLL support for picture_size R_2007+, add has_*_visualstyle R_2010+. * src/encode.c (dwg_encode_entity, dwg_encode_object): likewise. 2018-03-27 Reini Urban maint: add error messages, copyright header * src/reedsolomon.c: add copyright header, if DEBUG unused coe * src/decode_r2007.c: add LOG_ERROR messages to the error branches fix test/testcases default worked ok via make check, but not from the cmdline maint of examples/load_dwg.py fix the name in usage, fix style cleanup testcases fix the remaining warnings, cleanup the remaining junk boilerplate, add decls. 2018-03-27 Reini Urban win32: unknown conversion type character h in format for RC on mingw64 * src/dwg.h: special-case FORMAT_RC on windows. 2018-03-27 Reini Urban fix examples/dwg2svg2: get the center * examples/dwg2svg2.c: circle.center was never initialized. fix the paperspace limits calculation: LIM not EXT. use double, not float. * examples/dwg_ps.c: use double, not float. 2018-03-27 Reini Urban more work on R2010 objects And assert on invalid section/page sizes and counts. all r2007_file_header values for r2010 are still invalid. for 2007 only some. * src/decode.c (dwg_decode_data): enhance version mapper to all. simplify the warn and error messages for unknown versions. (resolve_objectref_vector): return success code. (decode_R2004): delete unused File Header Data fields, now parsed via spec (also encodable). * src/decode_r2007.c: add DBG_MAX_COUNT, DBG_MAX_SIZE asserts. * src/dwg.h, src/dwg.spec: more R2010+ fields for ATTRIB, ATTDEF, DIMENSION*. 2018-03-27 Reini Urban decode: demote some LOG_ERROR to LOG_WARN they are harmless mostly. libdxfrw just ignores them and much more. And LOG_ERROR should really panic, not continue. rename examples, dwg prefix all this to be able to use bin_PROGRAMS for faster debugging cycles, without tests or long cmdlines. anyway: rewrite => dwgrewrite, test => dwgread, testSVG => dwg2SVG, testsvg2 => dwg2svg2, get_bmp => dwgbmp Makefile.am: build examples before the tests often we need to test via an example before running the full testsuite 2018-03-27 Reini Urban fix the dxfname, no final * the last char is always \0, don't replace it with *. the len BS includes the final \0, but we keep that. we only store the ASCIIZ anyway. also don't replace unprintable chars with ~. we do support encode and codepages conversion later. with codepages isprint() is relative. thus unprintable chars can only be replaced in temp. print helpers. 2018-03-27 Reini Urban fix auxheader, trace types * src/auxheader.spec: RS unknown[10] => RS unknown_rs[6] + RL zero_l[5], print unknown_rs as hex. * src/dwg.h: print RC as 0x%hhx and BB as %uc. * src/logging.h: add final \n to LOG_ERROR and LOG_WARN. * src/dec_macros.h: trace the types also. needed for analysis. fixup make distcheck for test-data TODO: txttoxml.py: if built from a non-writable srcdir writing to the srcdir/test-data/*.xml will fail. eg make distcheck The XML must be written into the builddir. travis: add python-libxml2 decode_r2007: use inttypes use proper %PRIu64 for %lld format types. on 64bit %lld is for long long, but we have only simple uint64_t 2018-03-27 Reini Urban add WIPEOUT entity not an object, rather a IMAGE. also: fix obj->bitsize to BITCODE_RL, disable reading some unknown objects/entities, we have better code to deal with that. 2018-03-27 Reini Urban more unit-testing cleanup coding-style, less useless comments, fix some types, esp. TEXT vert_align, horiz_align, remove some more output_object() funcs. rename example.dwg to example_2000.dwg use versioned dwg names xmlsuite: move txttoxml.py move txttoxml.py from test-data to xmlsuite, where it belongs to. add skeletons for test-data/{r13,r14,2018} dwg.h: rename 4 internal _dwg_bitecode_* to _dwg_bitcode_3bd unused internally and in the API README, TODO: update * README: update outdated info * TODO: update outdated info * src/dwg.spec: add my name 2018-03-27 Reini Urban api: add missing entities OLEFRAME, OLE2FRAME, DUMMY, LONG_TRANSACTION, PROXY_ENTITY, IMAGE were missing the block extractor and object extractors. rename internal 3D_FACE type to 3DFACE for consistency: _dwg_entity_3D_FACE => _dwg_entity_3DFACE 2018-03-27 Reini Urban encode: limit the scope of obj, _obj to the enclosing block only. these are temp. values used in the helper macros. Fixes -Wshadow warnings src: fix format types in LOG calls, detected by the new type strictness Fix {vert,horiz}_align type from double to short and properly document it cleanup testcases use proper types, only one error, and much less trash. it really should have be written with type macros, but now this might be too much work for no gain. Move test-data DWGs into one global place refactor test dirs under one single base dir test. dejagnu only used for testcases. TODO: test-data cleanup unit-tests use proper types, only one error, and much less trash. it really should have be written with type macros, but now this might be too much work for no gain. dwg.h: better description of the raw types 2018-03-27 Reini Urban strict uint32_t/BITCODE_RL types not really long on 64bit systems. add RLL type support. be strict about BITCODE_BS, BITCODE_BL types. Note that the raw RS RL ... types are not native raw. They are network-encoded, i.e. big-endian. so they need to swap words. 2018-03-27 Reini Urban new Dwg_R2004_Header, use r2004_file_header.spec * src/decode.c: use new dec_macros.h, avoid -Wshadow, put spec readers into its separate blocks, indentation, unuse _2004_header_data, rather put into the global Dwg_Struct, use the new "r2004_file_header.spec". * src/decode_r2007.c (decrypt_block): added * src/dwg.h: use stdint types also for BITCODE_BL (not long, uint32_t), add BITCODE_RLL (uint64_t) for decode_r2007, identify some more header fields, add r2004_header, with padding. * src/dwg.c: use FORMAT_* types. add dec_macros.h, r2004_file_header.spec, spec.h decode macros are to be used for src/decode_r2007.c also. extract the common spec macros. add r2004_file_header.spec for the 2004 File Header, and fix two addresses there. automake: harmonize LDADD decode_r2007.c: import rs_decode_block * src/decode_r2007.c: import rs_decode_block * src/reedsolomon.c: whitespace, GNU formatted 2018-03-27 Alex Papazoglou Reed-Solomon (255,239) codec. Two routines, rs_encode_block() and rs_decode_block() are provided. The first will encode a block, depositing the 16 parity bytes in a caller-preallocated buffer. The second decodes a block; if there are errors it optionally fixes them in place using the Euclidean algorithm. Two example programs are provided to demonstrate. rurban: guarded malloc.h * examples/rsdecode.c: decode a stream * examples/rsencode.c: encode a stream * Makefile.am: added reedsolomon.c * decode_r2007.c: incorporated rs_decode_block() * reedsolomon.c: Reed-Solomon codec. 2018-03-27 Reini Urban cosmetics fix parenthandle code in 2 classes with r2000 MLINESTYLE and DICTIONARY parenthandle codes are 8, not 4. 2018-03-27 Reini Urban more C99: add stdint.h, inttypes.h needed only for the bits_test.c testcase, which needs uint16_t. But it is used in bits, even publicly, so put it into common.h * src/common.h: include config.h, , . * src/bits.c: include , . 2018-03-27 Reini Urban examples: add config.h for better inttypes * examples/dwg_ps.c: add config.h * examples/get_bmp.c: add config.h * examples/load_dwg.c: add config.h * examples/rewrite.c: add config.h * examples/test.c: add config.h * examples/testSVG.c: add config.h * examples/testsvg2.c: add config.h 2018-03-27 Reini Urban add WIPEOUT undocumented class, but seen in the wild cleanup public headers no c++ comments, check STDC optionally for better inttypes use inttypes for uint16_t vs %hu remove logging.h dependency 2018-03-27 Reini Urban more automake improvements add AM_SILENT_RULES. add missing DIST files, fixes distcheck. testsuite/testcases: add -lm, failed on linux/gcc, passed on the smokers and everywhere else. * Makefile.am: add LIBTOOL_DISTCLEAN_FILES. * configure.ac: add AM_SILENT_RULES. * src/Makefile.am: add EXTRA_HEADERS, esp. the new specs. * testsuite/testcases/Makefile.am: add -lm to LDADD * testsuite/xmlsuite/Makefile.am: remove CFLAGS exception, it is now globally 2018-03-27 Reini Urban .appveyor.yml: skip dejagnu on cygwin for now fails to link for some unknwn reason. passes all configure probes tests. See https://github.com/rurban/libredwg/issues/1 rename CELLSTYLEMAP_Cell.class to .type a reserved keyword more header_vars: FLAGS, ... split FLAGS into some known flags, set defaults for some new vars, BLIPMODE, DIMSAV are used earlier than R13, the 4 unknown texts are used only before R_2007 Fix the DIMJUST bug DIMTDEC was missing, a few lines above. change RS, BS to uint16_t a true short. add auxheader.spec previously known as unknown section 5 2018-03-27 Reini Urban More objects and versions Prepare for all the old versions. Add most missing new objects/classes. Rename IMAGEDEFREACTOR to IMAGEDEF_REACTOR, same as the dxf class name. Add CELLSTYLEMAP, FIELD/AcDbField, VISUALSTYLE (undocumented fields, probably just a hard pointer to its dictionary). Add typed obejcts: OLEFRAME, DUMMY, LONG_TRANSACTION, PROXY_ENTITY, PROXY_OBJECT. Class/Object VBA_PROJECT is probably just handled in its own special section. Fix the text_area_is_present global variable, only set in decode, and make it a private field. Use 4BITS for the view_mode. Better named warn messages on unknown objects: print the unhandled/unknown name. Remove duplicate DIMJUST header_variable !?! Find name for TSTACKALIGN, TSTACKSIZE header_variables. Add LOG_WARN macro. 2018-03-27 Reini Urban Add to ChangeLog the missing entries since 2010-07-21 * ChangeLog: add missing entries 2018-03-27 Reini Urban cygwin libtools -no-undefined to be able to make a shared lib, without only static. * src/Makefile.am (libredwg_la_LDFLAGS): add -no-undefined for cygwin. 2018-03-27 Reini Urban abstract common file header into header.spec The header is basically the same for all versions. we read until num_sections, resp. the first encrypted block * src/header.spec: added. * src/decode.c (decode_R13_R15,decode_R2004,decode_R2007): use header.spec. * src/encode.c: use header.spec. * src/dwg.c: fix indentation, rename stk to dwg * src/dwg.h: named struct Dwg_Header, add header.spec variables 2018-03-27 Reini Urban add read+write r2004 header until the encryption at 0x80 rework file header <=r15 fill in the missing file header bits, for encode to be byte equal. rename unknown 1 section to 5 (which it is). configure.ac: set CFLAGS=-g no optimization yet needed. turn it on later 2018-03-27 Reini Urban .travis.yml: debug make distcheck only failing remotely. ok locally * .travis.yml: fixup make distcheck 2018-03-27 Reini Urban Cleanup the CRC error messages 2018-03-27 Reini Urban Fix the section 0 crc comparison, add HANDLE logging CRC was already read by header_vars.spec into the CRC field. Don't read it again. The initial crc check passes now. Separate HANDLE from INSANE logging levels. INSANE for the individual VECTOR values, i.e. string and binary content. 2018-03-27 Reini Urban fix crc, rename bit_ckr8 to bit_calc_CRC export bit_calc_CRC: it is used by decode.c use uint16_t to guarantee proper overflow. rewrite does now write examples/example.dwg successfully. translate more bit_datenaro * src/bits.c, src/bits.h: use uint16_t for the seed and crc, rename bit_ckr8 to bit_calc_CRC. * configure.ac: add AC_TYPE_UINT16_T * src/decode.c, testsuite/testcases/bits_test.c: use renamed bit_calc_CRC function 2018-03-27 Reini Urban doc: add basic types rewrite.exe alive.test fix testcases: fix more wrong types 2018-03-27 Reini Urban refactor both unit tests extract the common function output_object into common.c via the arg DWG_TYPE. fix some wrong leftover float and int types. 2018-03-27 Reini Urban fix more dwg_api int types to the BITCODE types. There were still several errors, found out in the unit tests. unit-testing: fix wrong float variables to double decode_r2007: add missing function declarations * src/decode_r2007.c: add missing function declarations. 2018-03-27 Reini Urban examples/Makefile.am: add CLEANFILES and check-syntax. Fixes make distcheck. * examples/Makefile.am: add CLEANFILES, check-syntax 2018-03-27 Reini Urban fix examples/dwg_ps * examples/Makefile.am: fix dwg_ps_LDADD. * examples/dwg_ps.c: various fixes. print.c: declare assert.h used in dwg.spec: assert(FIELD_VALUE(scale_flag) == 0) dwg_encode_chains: initialize ckr_missing at the beginning, not just in the loop. MINSERT spec * src/dwg.spec (MINSERT): fix check logic: no multiple x == y == z expr, avoid sequence point problems when initializing: x=y=z=1.0 dwg_encode_chains: fix handle swap code * src/encode (dwg_encode_chains): fixed the handle swap code fix detected warnings duplicate decarations, unused variables, declaration after statement, ... 2018-03-27 Reini Urban fix SWIG_LIB windows newline mingw64 swig -swiglib prints a newline after each lib, there are two: SWIG_LIB = C:\msys64\MINGW64\bin\Lib C:/msys64/MINGW64/share/swig/3.0.12 * m4/ax_pkg_swig.m4: strip \r\n in SWIG_LIB 2018-03-27 Reini Urban probe for warn, mingw and valgrind Add probes for mingw cross-compilation (testing via wine), c99, compile-time SIZEOF(size_t) (for BLL, ULL), useful warning flags and valgrind. This caught a lot of errors. * configure.ac: add many probes * src/Makefile.am: add @WARN_CFLAGS@ * testsuite/testcases/Makefile.am: add @WARN_CFLAGS@, @VALGRIND_CHECK_RULES@ * testsuite/xmlsuite/Makefile.am: add @VALGRIND_CHECK_RULES@ * unit-testing/Makefile.am: add @WARN_CFLAGS@, @VALGRIND_CHECK_RULES@ * .gitignore: adjust for m4 changes * m4/.placeholder: not longer needed. * m4/ax_append_compile_flags.m4: added. * m4/ax_append_flag.m4: added. * m4/ax_append_link_flags.m4: added. * m4/ax_check_compile_flag.m4: added. * m4/ax_check_link_flag.m4: added. * m4/ax_compile_check_sizeof.m4: added. * m4/ax_compiler_flags.m4: added. * m4/ax_compiler_flags_cflags.m4: added. * m4/ax_compiler_flags_gir.m4: added. * m4/ax_compiler_flags_ldflags.m4: added. * m4/ax_is_release.m4: added. * m4/ax_require_defined.m4: added. * m4/ax_valgrind_check.m4: added. 2018-03-27 Reini Urban add .appveyor.yml Tested at https://ci.appveyor.com/project/rurban/libredwg. This is optional, but can be used to create binary releases for windows/cygwin 2018-03-27 Reini Urban fix make distcheck add missing EXTRA_DIST files * unit-testing/Makefile.am: add common.c to EXTRA_DIST, fix AM_CFLAGS for make distcheck. 2018-03-27 Reini Urban doc: fill in some basics 2018-03-27 Reini Urban libredwg.la: direct -lm dependency we use now nan() in the API code. * src/Makefile.am: add -lm to libredwg_la_LDFLAGS. * examples/Makefile.am: remove -lm from LDADD, use LDADD not AM_LDFLAGS, add -Wall to AM_CFLAGS. * testsuite/testcases/Makefile.am: remove -lm from LDADD. * testsuite/xmlsuite/Makefile.am: remove -lm from LDADD. * unit-testing/Makefile.am: remove -lm from LDADD. 2018-03-27 Reini Urban unit-testing/Makefile.am: add -lm for nan(). clang does not have it, only gcc configure.ac: whitespace use python_PYTHON fixed make distcheck. See https://www.gnu.org/software/automake/manual/html_node/Python.html add a .travis.yml configured at https://travis-ci.org/rurban/libredwg/ but you can clone and configure your own. it's optional. support rewrite as other version when encoding into another version than the original dwg version, check and ignore empty handles, and use empty strings, and numbers as default. 2018-03-27 Reini Urban build: make swig and dejagnu optional make python bindings only with swig and python. run dejagnu tests only with dejagnu. * Makefile.am: optional bindings and testsuite SUBDIRS. * testsuite/Makefile.am: optional testcases SUBDIRS. * configure.ac: export HAVE_DEJAGNU and HAVE_SWIG_PYTHON to automake. 2018-03-27 Reini Urban fix swig with stdint.h skip importing from stdint.h, but we need dwg.i importing from dwg.h and dwg_api.h. * src/dwg.h: no SWIGIMPORTED for stdint.h. * bindings/python/Makefile.am (swig_wrap_python.c): remove -I/usr/include. 2018-03-27 Reini Urban src/Makefile.am: cleanup no functional changes. * src/Makefile.am: minor cleanup, no changes. 2018-03-27 Reini Urban Fix bit_write_4BITS and its testcase bit_write_4BITS_tests. simply write 4 bits. used in VIEW view_mode. All testcases pass now. * src/bits.c (bit_write_4BITS): fix implementation. * testsuite/testcases/bits_test.c: enhance tests a bit, print the failing result, no functional changes. 2018-03-27 Reini Urban fix testcases/lwpline wrong flags type, fix to BITCODE_BS. * testsuite/testcases/lwpline.c: fix flags type 2018-03-27 Reini Urban testcases: fix wrong float testcases used float with too low numeric precision to pass the tests. fix to BITCODE_BD ie double. Remaining test errors: bit_write_4BITS, lwpline reading flag * testsuite/testcases/arc.c, testsuite/testcases/attdef.c, testsuite/testcases/attrib.c, testsuite/testcases/circle.c, testsuite/testcases/ellipse.c, testsuite/testcases/line.c, testsuite/testcases/minsert.c, testsuite/testcases/mline.c, testsuite/testcases/mtext.c, testsuite/testcases/point.c, testsuite/testcases/polyline_2d.c, testsuite/testcases/shape.c, testsuite/testcases/solid.c, testsuite/testcases/text.c, testsuite/testcases/tolerance.c, testsuite/testcases/trace.c: change float to BITCODE_BD 2018-03-27 Reini Urban work on testsuites on macports with make check PYTHON=/opt/local/bin/python2.7 examples/alive.test: TODO the rewrite tests until we can fix them 2018-03-27 Reini Urban python: depend on src/dwg.h and add -I/usr/include for stdint.h (for uint64_t). Note that on macports with gcc-mp-x you need to use the gcc-specific -I/opt/local/lib/gcc6/gcc/x86_64-apple-darwin15/6.4.0/include instead. And build with the system python, but run the tests with macports python make check PYTHON=/opt/local/bin/python2.7 * bindings/python/Makefile.am: depend on src/dwg.h, add -I/usr/include for stdint.h 2018-03-27 Reini Urban WIP Start R_2013, R_2018 support, stricter types, ... add missing types, header variables, ... read and write 3B and BLL types, BLL: 64bit only. (this drops support for 32bit only, without uin64_t. maybe probe for that) 2018-03-15 Reini Urban cygwin libtools -no-undefined * src/Makefile.am (libredwg_la_LDFLAGS): add -no-undefined for cygwin. 2018-03-15 Reini Urban abstract common file header into header.spec * src/header.spec: added. * src/decode.c (decode_R13_R15,decode_R2004,decode_R2007): use header.spec. * src/encode.c: use header.spec. * src/dwg.c: fix indentation, rename stk to dwg * src/dwg.h: named struct Dwg_Header, add header.spec variables 2018-03-15 Reini Urban add read+write r2004 header until the encryption at 0x80 2018-03-15 Reini Urban * src/dwg.h: rework file header <=r15, fill in the missing file header bits, for encode to be byte equal. * src/decode.c (decode_R13_R15): rename unknown 1 section to 5 (which it is). * src/bits.c: style 2018-03-15 Reini Urban configure.ac: set CFLAGS=-g no optimization yet needed. turn it on later 2018-03-15 Reini Urban .travis.yml: debug make distcheck * .travis.yml: fixup make distcheck 2018-03-15 Reini Urban Cleanup the CRC error messages 2018-03-15 Reini Urban Fix the section 0 crc comparison, add HANDLE logging CRC was already read by header_vars.spec into the CRC field. Don't read it again. The initial crc check passes now. Separate HANDLE from INSANE logging levels. INSANE for the individual VECTOR values, i.e. string and binary content. 2018-03-15 Reini Urban fix crc, rename bit_ckr8 to bit_calc_CRC * src/bits.c, src/bits.h: use uint16_t for the seed and crc, rename bit_ckr8 to bit_calc_CRC. * configure.ac: add AC_TYPE_UINT16_T * src/decode.c, testsuite/testcases/bits_test.c: use renamed bit_calc_CRC function 2018-03-15 Reini Urban doc: add basic types 2018-03-15 Reini Urban rewrite.exe alive.test fix 2018-03-15 Reini Urban testcases: fix more wrong types 2018-03-15 Reini Urban refactor both unit tests extract the common function output_object into common.c via the arg DWG_TYPE. fix some wrong leftover float and int types. 2018-03-15 Reini Urban fix more dwg_api int types to the BITCODE types. There were still several errors, found out in the unit tests. 2018-03-15 Reini Urban unit-testing: fix wrong float variables to double 2018-03-15 Reini Urban decode_r2007: add missing function declarations * src/decode_r2007.c: add missing function declarations. 2018-03-15 Reini Urban examples/Makefile.am: add CLEANFILES * examples/Makefile.am: add CLEANFILES, check-syntax 2018-03-15 Reini Urban fix examples/dwg_ps * examples/Makefile.am: fix dwg_ps_LDADD. * examples/dwg_ps.c: various fixes. 2018-03-15 Reini Urban print.c: declare assert.h used in dwg.spec: assert(FIELD_VALUE(scale_flag) == 0) 2018-03-15 Reini Urban dwg_encode_chains: initialize ckr_missing at the beginning, not just in the loop. 2018-03-15 Reini Urban MINSERT spec * src/dwg.spec (MINSERT): fix check logic: no multiple x == y == z expr, avoid sequence point problems when initializing: x=y=z=1.0 2018-03-15 Reini Urban dwg_encode_chains: fix handle swap code * src/encode (dwg_encode_chains): fixed the handle swap code 2018-03-15 Reini Urban fix detected warnings duplicate decarations, unused variables, declaration after statement, ... 2018-03-15 Reini Urban fix SWIG_LIB windows newline * m4/ax_pkg_swig.m4: strip \r\n in SWIG_LIB 2018-03-15 Reini Urban probe for warn, mingw and valgrind * configure.ac: add many probes * src/Makefile.am: add @WARN_CFLAGS@ * testsuite/testcases/Makefile.am: add @WARN_CFLAGS@, @VALGRIND_CHECK_RULES@ * testsuite/xmlsuite/Makefile.am: add @VALGRIND_CHECK_RULES@ * unit-testing/Makefile.am: add @WARN_CFLAGS@, @VALGRIND_CHECK_RULES@ * .gitignore: adjust for m4 changes * m4/.placeholder: not longer needed. * m4/ax_append_compile_flags.m4: added. * m4/ax_append_flag.m4: added. * m4/ax_append_link_flags.m4: added. * m4/ax_check_compile_flag.m4: added. * m4/ax_check_link_flag.m4: added. * m4/ax_compile_check_sizeof.m4: added. * m4/ax_compiler_flags.m4: added. * m4/ax_compiler_flags_cflags.m4: added. * m4/ax_compiler_flags_gir.m4: added. * m4/ax_compiler_flags_ldflags.m4: added. * m4/ax_is_release.m4: added. * m4/ax_require_defined.m4: added. * m4/ax_valgrind_check.m4: added. 2018-03-15 Reini Urban add .appveyor.yml Tested at https://ci.appveyor.com/project/rurban/libredwg. This is optional, but can be used to create binary releases for windows/cygwin 2018-03-14 Reini Urban fix make distcheck * unit-testing/Makefile.am: add common.c to EXTRA_DIST, fix AM_CFLAGS for make distcheck. 2018-03-14 Reini Urban doc: fill in some basics 2018-03-14 Reini Urban libredwg.la: direct -lm dependency * src/Makefile.am: add -lm to libredwg_la_LDFLAGS. * examples/Makefile.am: remove -lm from LDADD, use LDADD not AM_LDFLAGS, add -Wall to AM_CFLAGS. * testsuite/testcases/Makefile.am: remove -lm from LDADD. * testsuite/xmlsuite/Makefile.am: remove -lm from LDADD. * unit-testing/Makefile.am: remove -lm from LDADD. 2018-03-14 Reini Urban unit-testing/Makefile.am: add -lm for nan(). clang does not have it, only gcc 2018-03-14 Reini Urban configure.ac: whitespace 2018-03-14 Reini Urban use python_PYTHON. fixed make distcheck. See https://www.gnu.org/software/automake/manual/html_node/Python.html 2018-03-14 Reini Urban add a .travis.yml configured at https://travis-ci.org/rurban/libredwg/ but you can clone and configure your own. it's optional. 2018-03-13 Reini Urban support rewrite as other version when encoding into another version than the original dwg version, check and ignore empty handles, and use empty strings, and numbers as default. 2018-03-13 Reini Urban build: make swig and dejagnu optional * Makefile.am: optional bindings and testsuite SUBDIRS. * testsuite/Makefile.am: optional testcases SUBDIRS. * configure.ac: export HAVE_DEJAGNU and HAVE_SWIG_PYTHON to automake. 2018-03-13 Reini Urban fix swig with stdint.h * src/dwg.h: no SWIGIMPORTED for stdint.h. * bindings/python/Makefile.am (swig_wrap_python.c): remove -I/usr/include. 2018-03-13 Reini Urban src/Makefile.am: cleanup * src/Makefile.am: minor cleanup, no changes. 2018-03-13 Reini Urban Fix bit_write_4BITS * src/bits.c (bit_write_4BITS): fix implementation. * testsuite/testcases/bits_test.c: enhance tests a bit, print the failing result, no functional changes. 2018-03-13 Reini Urban fix testcases/lwpline * testsuite/testcases/lwpline.c: fix flags type 2018-03-13 Reini Urban testcases: fix wrong float * testsuite/testcases/arc.c, testsuite/testcases/attdef.c, testsuite/testcases/attrib.c, testsuite/testcases/circle.c, testsuite/testcases/ellipse.c, testsuite/testcases/line.c, testsuite/testcases/minsert.c, testsuite/testcases/mline.c, testsuite/testcases/mtext.c, testsuite/testcases/point.c, testsuite/testcases/polyline_2d.c, testsuite/testcases/shape.c, testsuite/testcases/solid.c, testsuite/testcases/text.c, testsuite/testcases/tolerance.c, testsuite/testcases/trace.c: change float to BITCODE_BD 2018-03-13 Reini Urban work on testsuites on macports with make check PYTHON=/opt/local/bin/python2.7 2018-03-13 Reini Urban examples/alive.test: TODO the rewrite tests until we can fix them 2018-03-13 Reini Urban python: depend on src/dwg.h * bindings/python/Makefile.am: depend on src/dwg.h, add -I/usr/include for stdint.h 2018-03-13 Reini Urban WIP Start R_2013, R_2018 support, stricter types, ... add missing types, header variables, ... read and write 3B and BLL types, BLL: 64bit only. (this drops support for 32bit only, without uin64_t. maybe probe for that) 2018-03-12 Pero Brbora testsuite/testcases/endblk.c (api_process): Compare test values. 2018-03-12 Reini Urban dwg.spec: ANYCODE for parent, next, prev * src/common_entity_handle_data.spec: prev_entity may be 4 or 8, prev_entity may be 4 or 6, change to ANYCODE. * src/dwg.spec: XRECORD whitespace 2018-03-12 Reini Urban dwg.spec: handle insert_count * src/decode.c, src/encode.c, src/print.c, src/dwg.spec: add FIELD_INSERT_COUNT fixing print and encode of insert_count. add FIELD_TRACE as separate helper. add FIELD_HANDLE_N helper to print the actual vcount index. * src/encode.c (FIELD_HANDLE): add assertions and LOG_ERROR when handle_code deviates (HANDLE_VECTOR_N): add assertions. (dwg_encode_add_object): change long unsigned int to unsigned long 2018-03-12 Reini Urban dwg.spec: layout_handle in BLOCK_HEADER is code 5 2018-03-12 Reini Urban xmlsuite: unsigned char* conversion * testsuite/xmlsuite/common.c: replace char with xmlChar as used in libxml2 * testsuite/xmlsuite/testsuite.c: ditto 2018-03-12 Reini Urban fixup examples * examples/alive.test: rewrite needs two args * examples/rewrite.c: need USE_WRITE, fixup error message * examples/testsvg2.c: add log_if_error checks, add argv[1] check, fix c99 block decl, fix handle returning a handle, not struct. * get_bmp.c: unsigned char* dwg_bmp 2018-03-12 Reini Urban fix dwg_api * src/dwg_api.{c,h}: add missing checks for an empty 2nd arg add missing return values in the error case. LOG_ERROR declare all accessors, fixing x86_64 E.g. fixing http://lists.gnu.org/archive/html/libredwg/2017-07/msg00000.html caused by the wrong default type being added for the undeclared functions, capping pointers at 32bit. change TV from unsigned char* to char*, only the internal methods need to use unsigned char*. harmonized with the external field types. changed *get_block_size accessors to return the natural unsigned long * type, not long *. change API to return pointers, not structs for: dwg_obj_appid_get_appid_control, dwg_obj_get_handle, dwg_ent_insert_get_ref_handle * src/api.h, src/api.c: deleted * Makefile.am: add .c.i: and check-syntax emacs flymake targets 2018-03-11 Reini Urban [maint] Fix compilation errors and warnings * configure.ac: probe for malloc.h. * src/decode.c: global loglevel, static variable 'loglevel' is used in an inline function with external linkage [-Wstatic-in-inline]. dwg_decode_handleref_with_code make global: [-Wstatic-in-inline]. * src/encode.c: declare dwg_encode_handleref, dwg_encode_handleref_with_code, dwg_encode_common_entity_handle_data, dwg_encode_common_entity_handle_data: declare it as static. * src/dwg.c: fix various integer fmt types. get_first_owned_object: error with Unsupported version. get_next_owned_object: error with Unsupported version. declare dwg_encode_chains. * src/dwg_api.c: check HAVE_MALLOC_H. * .gitignore: add TAGS. 2015-12-11 gaganjyot [Fix] Memory Errors 2015-03-29 Thien-Thi Nguyen [v] Remove "make-check"-generated .xml files from repo. * testsuite/xmlsuite/DWG/DWG-Files/2000/Arc.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/ConstructionLine.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Donut.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Ellipse.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Helix.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Line.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Multiline.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Point.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/PolyLine3D.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Polygon.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Polyline.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/RAY.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Spline.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/Text.xml * testsuite/xmlsuite/DWG/DWG-Files/2000/circle.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Arc.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/ConstructionLine.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Donut.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Ellipse.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Helix.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Line.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Multiline.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Point.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/PolyLine3D.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Polygon.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Polyline.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/RAY.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Spline.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/Text.xml * testsuite/xmlsuite/DWG/DWG-Files/2004/circle.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Arc.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/ConstructionLine.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Donut.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Ellipse.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Helix.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Line.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Multiline.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Point.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/PolyLine3D.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Polygon.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Polyline.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/RAY.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Spline.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/Text.xml * testsuite/xmlsuite/DWG/DWG-Files/2007/circle.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Arc.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/ConstructionLine.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Donut.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Ellipse.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Helix.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Line.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Multiline.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Point.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/PolyLine3D.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Polygon.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Polyline.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/RAY.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Spline.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/Text.xml * testsuite/xmlsuite/DWG/DWG-Files/2010/circle.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Arc.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/ConstructionLine.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Donut.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Ellipse.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Helix.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Line.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Multiline.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Point.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/PolyLine3D.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Polygon.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Polyline.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/RAY.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Spline.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/Text.xml * testsuite/xmlsuite/DWG/DWG-Files/2013/circle.xml: Delete file. 2015-03-29 Thien-Thi Nguyen [v] Remove another xmlsuite "make check"-generated file. * testsuite/xmlsuite/result.htm: Delete file. 2015-03-29 Thien-Thi Nguyen [v] Remove xmlsuite "make check"-generated files from repo. * testsuite/xmlsuite/test_output/2000/ConstructionLine.xml * testsuite/xmlsuite/test_output/2000/Donut.xml * testsuite/xmlsuite/test_output/2000/Ellipse.xml * testsuite/xmlsuite/test_output/2000/Helix.xml * testsuite/xmlsuite/test_output/2000/Line.xml * testsuite/xmlsuite/test_output/2000/Multiline.xml * testsuite/xmlsuite/test_output/2000/Point.xml * testsuite/xmlsuite/test_output/2000/PolyLine3D.xml * testsuite/xmlsuite/test_output/2000/Polygon.xml * testsuite/xmlsuite/test_output/2000/Polyline.xml * testsuite/xmlsuite/test_output/2000/RAY.xml * testsuite/xmlsuite/test_output/2000/Spline.xml * testsuite/xmlsuite/test_output/2000/Text.xml * testsuite/xmlsuite/test_output/2000/circle.xml * testsuite/xmlsuite/test_output/2004/Arc.xml * testsuite/xmlsuite/test_output/2004/ConstructionLine.xml * testsuite/xmlsuite/test_output/2004/Donut.xml * testsuite/xmlsuite/test_output/2004/Ellipse.xml * testsuite/xmlsuite/test_output/2004/Helix.xml * testsuite/xmlsuite/test_output/2004/Line.xml * testsuite/xmlsuite/test_output/2004/Multiline.xml * testsuite/xmlsuite/test_output/2004/Point.xml * testsuite/xmlsuite/test_output/2004/PolyLine3D.xml * testsuite/xmlsuite/test_output/2004/Polygon.xml * testsuite/xmlsuite/test_output/2004/Polyline.xml * testsuite/xmlsuite/test_output/2004/RAY.xml * testsuite/xmlsuite/test_output/2004/Spline.xml * testsuite/xmlsuite/test_output/2004/Text.xml * testsuite/xmlsuite/test_output/2004/circle.xml: Delete files. 2015-03-27 Thien-Thi Nguyen [v unit] Fix bug: Handle program invocation w/o args. * unit-testing/Makefile.am (TESTS_ENVIRONMENT): New var. * unit-testing/common.c (main): Don't blindly operate on ‘argv[1]’; instead, use the value of env var ‘INPUT’, if available, else print error message and exit failurefully. 2015-03-27 Thien-Thi Nguyen [dist] Fix bug: Also distribute example.dwg. * unit-testing/Makefile.am (EXTRA_DIST): New target. 2015-03-26 Pero Brbora [v xml] Fix bug: Avoid segfault: free only in non-error path. * testsuite/testcases/common.c (test_code): Don't call ‘dwg_free’ unconditionally; instead, call it only in the case where there are no errors. 2015-02-21 Thien-Thi Nguyen [boot] Bump minimal version of Automake to 1.12.2. * configure.ac (AM_INIT_AUTOMAKE): ...here. 2015-02-20 Thien-Thi Nguyen [boot] Don't specify $(srcdir) explicitly. * bindings/python/Makefile.am (BUILT_SOURCES): Remove ‘$(srcdir)/’. (swig_wrap_python.c): Rename target from ‘$(srcdir)/swig_wrap_python.c’. 2015-02-20 Thien-Thi Nguyen [v] Add unit-testing/ to "make check" flow. * Makefile.am (SUBDIRS): Add unit-testing, immediately after src. * configure.ac (AC_CONFIG_FILES): Add unit-testing/Makefile. * unit-testing/Makefile: Delete file. * unit-testing/Makefile.am: New file. * unit-testing/.gitignore: New file. 2015-02-20 Thien-Thi Nguyen [v] Do testing serially. * configure.ac (AM_INIT_AUTOMAKE): Add option ‘serial-tests’. 2014-12-10 Thien-Thi Nguyen [maint] Remove site.exp files from repo. * testsuite/site.exp: Delete file. * testsuite/testcases/site.exp: Delete file. 2014-12-05 Thien-Thi Nguyen [v] Fix bug: Collapse individual tuple-item assignments. * testsuite/xmlsuite/check.py : Don't assign to ‘result[0]’ and ‘result[1]’ separately; instead, assign a literal 2-tuple to ‘result’, once. 2014-12-04 Thien-Thi Nguyen [v] Make testsuite/testcases progs link against in-tree libredwg.la. * testsuite/testcases/Makefile.am (LDADD): New var. (AM_CFLAGS): Delete var. 2014-12-03 Thien-Thi Nguyen [v] Explicitly name testsuite/testcases support files. * testsuite/testcases/Makefile.am (paired, unpaired): New vars. (check_PROGRAMS): Use $(paired) and $(unpaired). (EXTRA_DIST): Add example.dwg, vertex.mesh, common.c, ole2frame.c; replace ‘check_PROGRAMS’ ref w/ ‘paired’. 2014-11-29 Thien-Thi Nguyen [v] Distribute testsuite/testcases support files. * testsuite/testcases/Makefile.am (EXTRA_DIST): New var. 2014-11-27 Thien-Thi Nguyen [v] Declare helper.py encoding. * testsuite/xmlsuite/helper.py: Add Emacs-style ‘coding:’ comment as first line. 2014-11-26 Thien-Thi Nguyen [maint] Remove *.pyc files from repo. * testsuite/xmlsuite/check.pyc: Delete file. * testsuite/xmlsuite/helper.pyc: Delete file. 2014-11-26 Thien-Thi Nguyen [v] Streamline invocation of sub-program txttoxml.py. * testsuite/xmlsuite/Makefile.am (TESTS_ENVIRONMENT): Also set env var ‘PYTHON’. * testsuite/xmlsuite/helper.py: Import ‘glob’. (generatexml): Don't invoke txtgenerate.sh; instead, iterate the invocation of program txttoxml.py over the list of */*.txt files. * testsuite/xmlsuite/DWG/DWG-Files/txttoxml.py: Do ‘chmod -x’. * testsuite/xmlsuite/DWG/DWG-Files/txtgenerate.sh: Delete file. 2014-11-23 Thien-Thi Nguyen [v] Use Python interpreter discovered by configure script. * testsuite/xmlsuite/Makefile.am (TESTS_ENVIRONMENT): New var. * testsuite/xmlsuite/check.py: Remove shebang; chmod -x. 2014-11-21 Thien-Thi Nguyen [v] Make xmlsuite data files non-executable. * testsuite/xmlsuite/DWG/DWG-Files/2000/Arc.bak: * testsuite/xmlsuite/DWG/DWG-Files/2000/Arc.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Arc.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Arc.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/ConstructionLine.bak: * testsuite/xmlsuite/DWG/DWG-Files/2000/ConstructionLine.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/ConstructionLine.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/ConstructionLine.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Donut.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Donut.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Donut.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Ellipse.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Ellipse.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Ellipse.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Helix.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Helix.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Helix.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Line.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Line.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Line.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Multiline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Multiline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Multiline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Point.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Point.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Point.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/PolyLine3D.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/PolyLine3D.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/PolyLine3D.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Polygon.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Polygon.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Polygon.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Polyline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Polyline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Polyline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/RAY.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/RAY.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/RAY.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Spline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Spline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Spline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/Text.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Text.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/Text.txt: * testsuite/xmlsuite/DWG/DWG-Files/2000/circle.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2000/circle.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2000/circle.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Arc.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Arc.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Arc.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/ConstructionLine.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/ConstructionLine.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/ConstructionLine.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Donut.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Donut.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Donut.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Ellipse.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Ellipse.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Ellipse.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Helix.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Helix.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Helix.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Line.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Line.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Line.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Multiline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Multiline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Multiline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Point.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Point.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Point.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/PolyLine3D.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/PolyLine3D.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/PolyLine3D.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Polygon.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Polygon.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Polygon.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Polyline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Polyline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Polyline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/RAY.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/RAY.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/RAY.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Spline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Spline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Spline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/Text.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Text.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/Text.txt: * testsuite/xmlsuite/DWG/DWG-Files/2004/circle.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2004/circle.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2004/circle.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Arc.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Arc.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Arc.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/ConstructionLine.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/ConstructionLine.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/ConstructionLine.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Donut.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Donut.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Donut.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Ellipse.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Ellipse.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Ellipse.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Helix.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Helix.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Helix.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Line.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Line.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Line.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Multiline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Multiline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Multiline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Point.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Point.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Point.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/PolyLine3D.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/PolyLine3D.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/PolyLine3D.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Polygon.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Polygon.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Polygon.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Polyline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Polyline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Polyline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/RAY.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/RAY.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/RAY.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Spline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Spline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Spline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/Text.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Text.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/Text.txt: * testsuite/xmlsuite/DWG/DWG-Files/2007/circle.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2007/circle.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2007/circle.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Arc.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Arc.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Arc.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/ConstructionLine.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/ConstructionLine.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/ConstructionLine.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Donut.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Donut.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Donut.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Ellipse.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Ellipse.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Ellipse.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Helix.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Helix.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Helix.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Line.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Line.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Line.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Multiline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Multiline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Multiline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Point.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Point.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Point.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/PolyLine3D.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/PolyLine3D.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/PolyLine3D.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Polygon.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Polygon.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Polygon.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Polyline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Polyline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Polyline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/RAY.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/RAY.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/RAY.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Spline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Spline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Spline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/Text.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Text.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/Text.txt: * testsuite/xmlsuite/DWG/DWG-Files/2010/circle.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2010/circle.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2010/circle.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Arc.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Arc.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Arc.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Arc.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/ConstructionLine.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/ConstructionLine.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/ConstructionLine.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/ConstructionLine.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Donut.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Donut.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Donut.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Donut.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Ellipse.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Ellipse.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Ellipse.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Ellipse.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Helix.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Helix.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Helix.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Helix.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Line.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Line.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Line.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Line.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Multiline.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Multiline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Multiline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Multiline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Point.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Point.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Point.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Point.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/PolyLine3D.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/PolyLine3D.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/PolyLine3D.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Polygon.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Polygon.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Polygon.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Polygon.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Polyline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Polyline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Polyline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/RAY.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/RAY.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/RAY.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/RAY.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Spline.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/Spline.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Spline.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Spline.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/Text.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Text.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/Text.txt: * testsuite/xmlsuite/DWG/DWG-Files/2013/circle.bak: * testsuite/xmlsuite/DWG/DWG-Files/2013/circle.dwg: * testsuite/xmlsuite/DWG/DWG-Files/2013/circle.jpg: * testsuite/xmlsuite/DWG/DWG-Files/2013/circle.txt: Do ‘chmod -x’. 2014-11-21 Thien-Thi Nguyen [v] Distribute xmlsuite support files. * testsuite/xmlsuite/Makefile.am (EXTRA_DIST): Add DWG, header.htm, helper.py, $(TESTS). 2014-11-19 Thien-Thi Nguyen [v] Use ‘LDADD’ and full libredwg.la filename. * testsuite/xmlsuite/Makefile.am (LDADD): Rename from ‘AM_LDFLAGS’; specify explicit location of libredwg.la. 2014-11-16 Thien-Thi Nguyen [v] Don't forget to distribute common.c. * testsuite/xmlsuite/Makefile.am (EXTRA_DIST): Add common.c. 2014-11-16 Thien-Thi Nguyen [v] Don't forget to distribute suffix.c. * testsuite/xmlsuite/Makefile.am (EXTRA_DIST): New var. 2014-10-22 Thien-Thi Nguyen [build] Determine libxml2 flags at configure time. * configure.ac : Don't use ‘AC_CHECK_LIB’; instead, call ‘PKG_CHECK_MODULES’ for ‘libxml-2.0’ and update error message to mention that directly. (XML2_CFLAGS, XML2_LIBS): New AC_SUBST. * testsuite/xmlsuite/Makefile.am (LIBXML): Delete var. (AM_CPPFLAGS): New var. (AM_CFLAGS): Move everything except ‘-g’ to... (AM_LDFLAGS): ...this new var, and use $(XML2_LIBS). 2014-10-22 Thien-Thi Nguyen [build] Make configure script check for pkg-config(1). * configure.ac : Call ‘PKG_PROG_PKG_CONFIG’. 2014-08-18 Piyush Tweaking 2014-08-18 Piyush Removing binaries 2014-08-18 Piyush Final Commit 2014-08-18 Piyush Tweaking 2014-08-18 Piyush Tweaking 2014-08-18 Piyush Updating Doxygen File 2014-08-18 Piyush DOcumentation Updated 2014-08-16 Piyush Improved code formatting 2014-08-16 Piyush DOcumentation Updated 2014-08-16 Piyush Added dependencies. Integrated everything 2014-08-15 Piyush CLeaning 2014-08-14 Piyush Updated Tests 2014-08-13 Piyush Moved to testsuite folder 2014-08-11 Piyush Intregating xmlsuite 2014-08-10 Piyush Updating testsuite 2014-08-09 Piyush Removing unit tests folder 2014-08-07 Piyush Updating files 2014-08-02 Piyush Updated tests 2014-07-31 Piyush Tests for bits.c 2014-07-17 Piyush Moved it to xmlsuite folder for now 2014-07-17 Piyush Test suite with first unit test 2014-07-17 Piyush Moving the XML suite to different folder for now 2014-06-27 Piyush Commit the sample DWG files needed for test suite 2014-06-27 Piyush Removed the Previous DWG Files The files were not completely committed and there was error in it. So removed and will add the same files in the next commit 2014-06-27 Piyush Adding the dependent files 2014-06-27 Piyush Adding python script which will generate %age 2014-06-13 Piyush Adding Initial Files 2014-04-13 gaganjyot API Merge with clean doc folder 2014-04-12 Rodrigo Rodrigues da Silva [r] ignore Object_Ref resolving when handle is null 2013-09-24 gaganjyot Documentation updated, Comments added 2013-09-24 gaganjyot Documentation updated, Comments added 2013-09-23 gaganjyot Documentation added 2013-09-20 gaganjyot Comments added, Make clean target for unit testing 2013-09-19 gaganjyot Comments added 2013-09-18 gaganjyot check target for unit tests 2013-09-18 gaganjyot api -> dwg_api 2013-09-18 gaganjyot removed api.c error from testsvg2.c 2013-09-18 gaganjyot library with unit-testing 2013-09-17 gaganjyot complete unit testing with makefile 2013-09-16 gaganjyot entity functions uncommented 2013-09-15 gaganjyot unit tests added with comments 2013-09-14 gaganjyot updated comments for unit tests 2013-09-13 gaganjyot unit tests added 2013-09-11 gaganjyot More unit tests added 2013-09-01 gaganjyot added more unit tests 2013-08-31 gaganjyot added unit testing, improved testsvg 2013-08-24 gaganjyot Bugs fixed 2013-08-24 gaganjyot Bugs removed 2013-08-13 gaganjyot error in appid fixed 2013-08-01 gaganjyot Updated code and some comments,Removed un-necassary code 2013-07-31 gaganjyot code formatted, Minor bug fixes 2013-07-29 gaganjyot New SVG Converter, Without low level access 2013-07-29 gaganjyot New SVG converter using the API, Added extra functions for objects and reference object 2013-07-29 gaganjyot Added extra functions for object, reference and block_header, New SVG converter 2013-07-28 gaganjyot Table entity support added 2013-07-27 gaganjyot added support for body, region, 3dsolid and vertex_pface_face with error reporting 2013-07-27 gaganjyot added support for mline, 3dface 2013-07-27 gaganjyot Added support for polyline2d, polyline3d, polyline_mesh and polyline_pface 2013-07-27 gaganjyot Added support for spline, lwpline, ole2frame and viewport 2013-07-26 gaganjyot added functions for leader, mtext, leader, shape, endblk 2013-07-26 gaganjyot Total Support For Dimensions with error reporting 2013-07-25 gaganjyot Updated error handling, added few functions for dimension ordinate 2013-07-24 gaganjyot Error reporting for all functions added 2013-07-24 gaganjyot support for error reporting in line,circle,arc 2013-07-23 gaganjyot More functions for entiies and objects, Comments updated 2013-07-22 gaganjyot Initial commit 2011-01-20 Rodrigo Rodrigues da Silva [bind] Wrap Object_Data *object as array. Fixes #32186 * bindings/dwg.i: use carrays.i to generate helper functions * examples/load_dwg.py: updated python example with correct usage of array 2011-01-20 Rodrigo Rodrigues da Silva Added missing #ifdef switch to dwg_write_file()'s prototype 2011-01-19 Rob Vermaas use AX_SWIG_PYTHON_CPPFLAGS variable in stead of hardcoded /usr/include/python2.6 2011-01-05 Till Heuschmann [build] applied patch from Rob Vermaas Thanks also to Timo VJ Lähde for reporting this error. decode_r2007.c: Do not use sys/malloc.h include 2010-12-28 Till Heuschmann [r] Decode R2007 Metadata Decode Metadata including file header, page map, section map dwg.h: Add type for wide character strings decode_r2007.c: Decode Metadata 2010-12-27 Till Heuschmann [build] Add R2007 decoder 2010-12-27 Till Heuschmann [build] Add R2007 decoder decode_r2007.c: Source file for all functions that are only needed to decode R2007 files. 2010-10-30 Rodrigo Rodrigues da Silva [r,w] Fixed typo in sentinel * common.c: second byte of DWG_SENTINEL_CLASS_END was typed "5L" instead of "5E" 2010-10-30 Rodrigo Rodrigues da Silva [w] fixed header variables overflow * src/encode.c: fixed two-byte overflow after Header Variables section's CRC. 2010-10-30 Rodrigo Rodrigues da Silva [w] Writing objects to bitstream correctly - or at least almost. * encode.c: fixed dwg_encode_chains() to call dwg_encode_add_objects() at the correct point, plus various fixes. It seems that some files are now written correctly to the bitstream. Although, unknown object types and objects with variable type (>500) are still skipped. I have also detected various situations in which the Header Variables and Classes sections of the new file are 2 bytes longer than the original file. Comparing both original and re-written files, I suspect that bit_write_CRC() is writing these two extra bogus bytes. 2010-10-30 Rodrigo Rodrigues da Silva [api] fixed missing prototype in header * dwg.h: added missing dwg_write_file() function prototype 2010-10-30 Rodrigo Rodrigues da Silva [w] Adding debug info to rewrite.c * rewrite.c: added debug messages 2010-10-05 Rodrigo Rodrigues da Silva [admin] Improve m4 quoting * configure.ac: according to Thien-Thi's suggestion at the mailing list, macro arguments are sorrounded by brackets to avoid confusion in case they become macros themselves. 2010-10-05 Rodrigo Rodrigues da Silva [doc] Explain use of underscore * bindings/python/Makefile.am: explain _libredwg_la 2010-10-05 Rodrigo Rodrigues da Silva [bind] Enhanced python example * examples/load_dwg.py: read file version and print object list. 2010-09-28 Ivan Radic crc check on 2010-09-28 Ivan Radic add return keyword 2010-09-28 Ivan Radic correct function name 2010-09-28 Ivan Radic correct field macros 2010-09-23 Rodrigo Rodrigues da Silva added missing .m4 file *m4/ax_python_devel.m4: required by AX_SWIG_PYTHON 2010-09-22 Rodrigo Rodrigues da Silva [admin] updated TODO list 2010-09-22 Rodrigo Rodrigues da Silva [admin] initial autotoolization of python bindings *configure.ac: add SWIG and Python macros *bindings/Makefile.am: new file, only points to bindings/python, don't know if it is really necessary, but one day we'll have other bindings and it might be useful *bindings/python/Makefile.am: new file, generate wrapper and build python module *autogen.sh: add -I m4 flag *m4/ax*.m4: swig macros from Autotools archive 2010-09-20 Rodrigo Rodrigues da Silva added python example *examples/load_dwg.py: load a DWG file and print some data 2010-09-20 Rodrigo Rodrigues da Silva [w] added dwg_add_object function *src/encode.c: added function that will call delegate object/entity encoding function based on object type. Not sure if works yet since dwg_encode_chains needs to be reviewed to call it at the correct point. Don't merge to trunk, it barely builds. 2010-09-20 Rodrigo Rodrigues da Silva fixed wrong function prototypes *dwg.h: wrong function prototypes - detected by SWIG 2010-09-20 Rodrigo Rodrigues da Silva [b] added python language bindings *bindings/dwg.i: SWIG interface to libredwg *bindings/python/Makefile: Makefile updated with target to generate wrapper and build Python module (to be removed soon when I will integrate SWIG with Autotools. *bindings/python/libredwgmodule.c: removed unnecessary wrapper. Wrapper is automatically generated by SWIG. 2010-08-30 Anderson Pierre Cardoso applied the patch from Rob Vermaas * src/Makefile.am 2010-08-19 Anderson Pierre Cardoso [w] encode_object now encode non-null stuff * src/encode.c 2010-08-18 Anderson Pierre Cardoso [w] worked more on the dwg_encode_entity function * src/encode.c 2010-08-17 Anderson Pierre Cardoso [w]quick fix in encode_entitys * src/encode.c 2010-08-16 Anderson Pierre Cardoso encoding null objects (OxOO), for validate the file structure * src/encode.c 2010-08-13 Anderson Pierre Cardoso [w]added common_entity_handle in encode.c * src/decode.c * src/encode.c * src/common_entity_handle_data.spec; new 2010-08-13 Rodrigo Rodrigues da Silva [w] fixing handle encoding macros *src/encode.c: rewrote FIELD_HANDLE macro, removed dwg_encode_handleref*() 2010-08-10 Anderson Pierre Cardoso [w] added some entry checking and usage warning for the rewrite.c test * examples/rewrite.c 2010-08-10 Rodrigo Rodrigues da Silva [w] cleaning up handle encoding *src/encode.c: cleaned up dwg_encode_handleref, write supposedly existing ref->handleref 2010-08-10 Anderson Pierre Cardoso cleaned the warnings during compiling * src/enode.c * src/decode.c * src/dwg.c 2010-08-09 Anderson Pierre Cardoso cleaned a duplicated macro (XDICOBJHANDLE) * src/encode.c : 125 2010-08-09 Anderson Pierre Cardoso added some macros and the encode_commom_entity_handle function * src/encode.c 2010-08-09 Anderson Pierre Cardoso cleaned duplicated header * src/bits.c 2010-08-09 Rodrigo Rodrigues da Silva [admin] Fixed missing file header *src/header_variables.spec: added missing copyright header 2010-08-07 Anderson Pierre Cardoso started to add some handle functions in encode (not fully working yet) * src/encode.c; func: macro FIELD_HANDLE, dwg_encode_handleref_with_code, dwg_encode_handleref 2010-08-02 Anderson Pierre Cardoso minor changes in encode.c and rewrite.c * src/encode.c * examples/rewrite.c 2010-07-23 Anderson Pierre Cardoso copy and pasted the header_variables spec on a header file and included it on the encode.c and decode.c * src/encode.c; changed * src/decode.c; changed * src/header_variables.spec; added 2010-07-23 Thien-Thi Nguyen [r] Fix typo in version codes array shape. * common.h (version_codes): Say "[8][7]", not "[7][8]". * common.c (version_codes): Likewise. 2010-07-23 Thien-Thi Nguyen [admin] Rename configure.in to configure.ac. * configure.ac: Rename from configure.in. 2010-07-23 Thien-Thi Nguyen [admin] Bump create-changelog version to "1.2". * build-aux/create-changelog (version): Bump to "1.2"; augment history. 2010-07-23 Thien-Thi Nguyen [admin] Add create-changelog option ‘--copyright WHO’. * build-aux/create-changelog (copyright-notice): New defvar.