Skip to content

cfFilterPWGToPDF continues after page preparation fails #166

Description

@kimaiden1984-boop

Summary

A PWG Raster page with an unsupported color space makes pwgtopdf log Color space not supported and then crash through a null callback.

Reproduction

Build current upstream with ASan/UBSan. Start from a parseable one-page PWG Raster stream (2SaR / PwgRaster sync), retain a complete page header and minimal payload, then set cupsColorSpace to a value not supported by prepare_pdf_page().

ASAN_OPTIONS=detect_leaks=0 PPD=candidate.ppd CONTENT_TYPE=application/vnd.cups-pwg 
  pwgtopdf 1 fuzzer fuzzer 1 'Resolution=300dpi PageSize=Letter' document.pwg >/dev/null

Result

Reproduced through the real pwgtopdf CLI with an ASan/UBSan build from libcupsfilters HEAD d63939da08eaef622a2443b7c9638d22c4d9831d and libppd HEAD 522af8dd135f4dde66b1aac8b9d067808bbe122d on 2026-07-19. The filter logs cfFilterPWGToPDF: Color space not supported, then ASan reports a SEGV in convert_raster() at cupsfilters/pwgtopdf.c:1637, calling doc->bit_function.

Cause and expected behavior

prepare_pdf_page() returns an error without initializing conversion callbacks. add_pdf_page() ignores that result at cupsfilters/pwgtopdf.c:1491, and convert_raster() later calls doc->bit_function. Propagate the preparation failure and abort the job cleanly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions