DjVuLibre 3.5.29 ZPCodec Unsigned Integer Overflow in Arithmetic Encoding
DjVuLibre 3.5.29版本中存在多个无符号整数溢出漏洞,主要集中在ZPCodec.cpp组件中的算术编码操作。这些问题可能导致缓冲区写入错误、内存损坏或程序崩溃。攻击者可以利用这些漏洞通过恶意输入触发溢出,进而导致系统不稳定或潜在的安全风险。这种情况在处理不受信任的PPM/DjVu文件时尤其危险。 2025-9-8 22:28:26 Author: seclists.org(查看原文) 阅读量:0 收藏

fulldisclosure logo

Full Disclosure mailing list archives


From: Ron E <ronaldjedgerson () gmail com>
Date: Sat, 6 Sep 2025 03:32:57 -0400

The DjVuLibre document compression library (tested version 3.5.29) contains
multiple instances of unsigned integer overflow in the ZPCodec.cpp
component. During arithmetic encoding operations (e.g., zemit, encode_lps,
encode_lps_simple, eflush), crafted input can cause arithmetic wraparound
(0-1, 1-2, or value+UINT_MAX). These operations rely on precise probability
modeling for entropy encoding, and wraparound corrupts encoder state. An
attacker can supply malicious input to c44 that triggers underflow, leading
to incorrect buffer writes, memory corruption, or crashes.


*Impact:*

   - Crash confirmed with UBSan.
   - Potential for corrupted encoded output, incorrect memory access, or
   exploitable memory corruption.
   - High risk in systems processing untrusted PPM/DjVu input.


*Proof of Concept:*

convert -size 1000x1000 gradient: overflow.ppm

ASAN_OPTIONS=detect_leaks=0,abort_on_error=1 \

UBSAN_OPTIONS=print_stacktrace=1 \

./tools/c44 overflow.ppm out.djvu


*Sanitizer Output:*

ZPCodec.cpp:1030:18: runtime error: unsigned integer overflow: 0 - 1 cannot
be represented in type 'unsigned int'

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ZPCodec.cpp:1030:18
_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: https://seclists.org/fulldisclosure/


Current thread:

  • DjVuLibre 3.5.29 ZPCodec Unsigned Integer Overflow in Arithmetic Encoding Ron E (Sep 08)

文章来源: https://seclists.org/fulldisclosure/2025/Sep/24
如有侵权请联系:admin#unsafe.sh