OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1.05k stars 187 forks source link

ppd-emit.c: Fix SEGV in 'ppdEmitString()' #850

Closed Drawishe closed 9 months ago

Drawishe commented 9 months ago

When using testppd.c as a harness, a fuzzer found a way to call ppdPageSize() with NULL return value. This caused a segmentation fault because the size structure, which is used by values[pos], was assigned a NULL value. To avoid this, we need to add a NULL value check for the size structure, free allocated memory, and return NULL.

Fixes #849

zdohnal commented 9 months ago

Note to myself - push it into libppd once merged.

zdohnal commented 9 months ago

Tests are failing on the similar place as before, so it looks ok to me.

zdohnal commented 9 months ago

@Drawishe thank you for the fix!

zdohnal commented 9 months ago

One late note - it would be great if you squashed the commits next time if possible, it gives cleaner git history.

jsmeix commented 9 months ago

@zdohnal did you really mean "git stash"?

zdohnal commented 9 months ago

@jsmeix thanks Johannes, it was really "squash"....