Loading
wsi-anon: heap overflow in ini-parser, out-of-bounds read and wrong unlink in tiff-based-io, Aperio fields left in place
As Christoph suggested in reply to my mail to info@empaia.org of 28 November 2026, here are the five WSI-Anon fixes as a merge request.
All five were found while building a prototype that records WSI-Anon's changes as a change plan and checks the result with an independent second reader, using the public OpenSlide test files (CC0). One commit per fix:
ini-parser.c,read_slidedat_ini_file: allocate one more element for the end markergroups[count_groups]. Before, AddressSanitizer reported a heap buffer overflow for every MIRAX file (CMU-1-Saved-1_16.mrxs); depending on heap layout, MIRAX detection failed.tiff-based-io.c,unlink_directory: readdirectories[current_dir + 1]only if a successor exists (out-of-bounds read, AddressSanitizer onCMU-1-Small-Region.svs).tiff-based-io.c,unlink_directory: for the last directory, zero the predecessor's pointer (in_pointer_offset, 4 bytes for classic TIFF, 8 for BigTIFF) instead of writing 8 zero bytes atout_pointer_offset. Before, the macro image stayed linked and its BitsPerSample became 0,0,0.aperio-flavor-io.c,remove_metadata_in_aperio: also replaceImageID,TitleandDSR IDwith X, likeFilename.aperio-flavor-io.c,handle_aperio: unlink the later of label and macro first, so the pointer offsets read beforehand stay valid.
Checks on this branch (based on main 66cb2281, platform 3.9.5): make tests builds without warnings and 32 of 32 unit tests pass, as on main. The same fixes have been in the build of my prototype since 18 November 2026, checked with AddressSanitizer and the second reader on CMU-1.svs, CMU-1-Small-Region.svs and CMU-1-Saved-1_16.mrxs.
Not changed, only noted:
- When unlinking a directory that has a successor, 8 bytes are copied also for classic TIFF (the pointer plus the 4 bytes before it, i.e. the value of the last entry). In the test files these bytes are equal, so the result stays correct.
- Under AddressSanitizer,
test_get_empty_char_buffer_without_prefix(test/unit/utils-test.c:89) reports a heap buffer overflow on main as well as on this branch.
License: MIT, like WSI-Anon.