Memory leak in PPD parser when processing duplicate JCLBegin/JCLEnd keywords
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- c
- Lĩnh vực
- security, testing-qa
Hướng nghiên cứu
Bắt đầu trong cups/ppd.c, tại hàm _ppdOpen(), ở phần xử lý JCLBegin và JCLEnd được xác định trong issue. Tái hiện với PPD có từ khóa trùng lặp hoặc testcase fuzzing, sau đó chạy fuzz_ppd_gen_cache dưới AddressSanitizer và LeakSanitizer. Hoàn thành khi các từ khóa trùng lặp không còn gây ra leak.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A memory leak vulnerability exists in the CUPS PPD parser (cups/ppd.c) when processing PPD files containing duplicate *JCLBegin or *JCLEnd keywords. Each duplicate keyword causes the previously allocated memory to be orphaned and permanently leaked.
Discovery Method
- Fuzzer:
fuzz_ppd_gen_cache - Detection: AddressSanitizer + LeakSanitizer
- Date: 2025-11-10
Vulnerability Details
Location
- File:
cups/ppd.c - Lines: 851 (JCLBegin), 856 (JCLEnd)
- Function:
_ppdOpen()
Root Cause
The parser calls strdup() to allocate memory for JCL keywords without freeing any previously allocated value:
// Line 850-853
else if (!strcmp(keyword, "JCLBegin"))
{
ppd->jcl_begin = strdup(string); // ❌ No free() before assignment
ppd_decode(ppd->jcl_begin);
}
If a PPD file contains multiple *JCLBegin lines:
- First occurrence: Allocates memory A, assigns to
ppd->jcl_begin - Second occurrence: Allocates memory B, overwrites
ppd->jcl_begin - Memory A is orphaned and leaked (cannot be freed)
The same issue exists for *JCLEnd at line 856.
LeakSanitizer Report
==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 9 byte(s) in 1 object(s) allocated from:
#0 0x5558f3468afa in strdup /src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:596:3
#1 0x5558f35267d2 in _ppdOpen /src/cups/cups/ppd.c:851:24
#2 0x5558f3530e76 in _ppdOpenFile /src/cups/cups/ppd.c:2283:11
#3 0x5558f34c65f7 in LLVMFuzzerTestOneInput /src/cups/ossfuzz/fuzz_ppd_gen_cache.c:289:23
SUMMARY: AddressSanitizer: 9 byte(s) leaked in 1 allocation(s).
Reproduction
Test Case
Fuzzer-generated input: leak-e4ef53d9b1772ff55e830f4060f2afb3c6a79270 (313 bytes)
Analysis shows the file contains two *JCLBegin keywords:
$ strings fuzzer_testcase.bin | grep JCLBegin
*JCLBegin:
*JCLBegin:
Minimal Reproducer
Create a PPD file with duplicate *JCLBegin:
*PPD-Adobe: "4.3"
*FormatVersion: "4.3"
*FileVersion: "1.0"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName: "LEAK.PPD"
*Manufacturer: "Test"
*Product: "(Test Printer)"
*ModelName: "Test Leak"
*ShortNickName: "Test"
*NickName: "Test Memory Leak"
*PSVersion: "(3010.000) 0"
*JCLBegin: "first_value"
*JCLBegin: "second_value"
*OpenUI *PageSize: PickOne
*DefaultPageSize: Letter
*PageSize Letter: ""
*CloseUI: *PageSize
- Ngôn ngữ chính
- C
- Star
- 8
- Fork
- 18
- Merge trung bình
- 7 giờ 37 phút
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OpenPrinting/fuzzing
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
OpenPrinting/fuzzing#45 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OpenPrinting/fuzzing#47 · 4 bình luận · 1 reaction ·
-
Memory allocation/deallocation mismatch in fuzz_array.c causes immediate crash with AddressSanitizer Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
OpenPrinting/fuzzing#43 ·
-
bug good first issue
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
OpenPrinting/fuzzing#7 ·
-
good first issue
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
OpenPrinting/fuzzing#5 · 1 bình luận ·
Tất cả issue của OpenPrinting/fuzzing
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
duckdb/duckdb-wasm#2258 ·
-
how does install.sh work Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
rofl0r/microsocks#110 ·
-
OTA is not aborted correctly Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
espressif/esp-aws-iot#261 ·
-
os:linux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
mpv-player/mpv#18510 · 2 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100