Natalia Portillo bbae748612 Fix data race in StuffIt X English dictionary initialization
The shared English word dictionary was built behind a plain `if(dict_ptrs)`
guard, which provides neither mutual exclusion nor memory ordering. Worse,
dict_ptrs was published by malloc before the pointer table was populated, so a
concurrent caller of the exported AARU_stuffitx_english_decode_buffer could
pass the guard and read uninitialized pointers. Two racing threads would also
both run the full PPMd decode, leaking the dictionary buffer.

Build the dictionary in locals and publish the statics only once the table is
complete, driven by pthread_once (POSIX) or InitOnceExecuteOnce (Windows), and
record the outcome so a failed build is never retried.

Also fix three adjacent issues in the same path: the word-scan loop
dereferenced p before bounds-checking it, the base-52 index accumulator could
overflow into a value that passed the bounds check, and the word buffer clamp
left no room for the appended terminator character.

Same class of bug as MacPaw/XADMaster#194.
2026-08-31 12:06:34 +01:00
2024-12-19 15:24:07 +00:00
2025-12-23 08:21:08 +00:00
2026-04-16 23:19:47 +01:00
2025-12-23 08:21:08 +00:00
2025-12-23 08:21:08 +00:00
2024-12-19 15:24:27 +00:00
2025-12-26 14:09:26 +01:00
2026-07-14 17:48:45 +01:00
2024-04-30 15:37:29 +01:00
2024-04-30 15:37:29 +01:00
2025-12-23 08:21:08 +00:00
2025-12-23 08:21:08 +00:00
2025-08-23 21:55:21 +01:00
2024-04-30 15:37:29 +01:00
2021-10-14 04:44:34 +01:00
2025-12-23 08:21:08 +00:00

Aaru.Compression.Native

This repository contains the Aaru.Compression.Native library for Aaru.

The purpose of this library is to provide compression and de-compression algorithms for Aaru.

No archiver processing code should fall here, those go in Aaru.Compression.

To build you just need Docker on Linux and run build.sh, that will generate a NuGet package for use with Aaru.Compression.

Currently implemented algorithms are:

General-purpose codecs

  • Apple Data Compression (RLE with sliding dictionary created for Apple Disk Copy's NDIF)
  • Apple LZH (LH1 variant used by Apple DART's "best" compression mode)
  • Apple RLE (Run Length Encoding created for Apple DART)
  • BZIP2
  • FLAC
  • KenCode (LZSS with variable-length prefix codes created for Apple Disk Copy's NDIF)
  • LZ4
  • LZFSE
  • LZIP
  • LZMA / LZMA2 / XZ
  • LZO
  • NDIF ShrinkWrap SIT2 (block Huffman LZSS from ShrinkWrap 3's Component Manager codec)
  • Zstandard

Archive decompressors

  • ACE v1 (LZ77) and v2 (blocked with delta/EXE/sound/picture modes)
  • ARC methods 3–9 (pack, squeeze, crunch, squash) and PAK methods 10–11 (crush, distill)
  • ARJ methods 1–4 and ARJZ (standard LZH and extended DEFLATE)
  • Compact Pro (RLE, LZH+RLE)
  • DiskDoubler (ADn LZSS, DDn block Huffman LZ77, adaptive Huffman, Stac LZS, Compact Pro, LZW)
  • HA (ASC and HSC)
  • LHA (LH1–LH7, LArc LZS/LZ5, PMarc PM1/PM2)
  • RAR 1.5 (custom LZ77 with fixed Huffman tables)
  • RAR 2.0 (block Huffman LZ77 with optional multichannel audio)
  • RAR 3.0 (Huffman LZ77 / PPMd Variant H with VM-based post-filters)
  • RAR 5.0 (Huffman LZ77 with native Delta/E8/E8E9/ARM filters)
  • StuffIt classic methods 1–3, 5, 8, 13–15 (RLE, LZW, Huffman, LZAH, MW, LZSS, Arsenic)
  • StuffIt X methods 0–4, 6 (Brimstone/PPMd, Cyanide/BWT, Darkhorse/LZSS, Deflate, Blend, Iron/BWT)
  • StuffIt X preprocessors (English dictionary, x86 executable transform)
  • ZIP methods 1–6, 9-10, 96–98 (Shrink, Reduce, Implode, DCL Implode, Deflate64, WinZip JPEG, WavPack, PPMd)
  • Zoo (LZD, LH5)

Each of these algorithms have a corresponding license, that can be found in their corresponding folder.

The resulting output of build.sh falls under the LGPL 2.1 license as stated in the LICENSE file.

Any new algorithm added should be under a license compatible with the LGPL 2.1 license to be accepted.

© 2021-2026 Natalia Portillo

Description
C library of compression algorithms used by Aaru.
Readme LGPL-2.1 36 MiB
Languages
C 94%
C++ 4.7%
CMake 0.8%
Shell 0.5%