]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
raster-interpreter.c: Fix crash in 'scan_ps()' found by fuzzer 834/head
authorZdenek Dohnal <zdohnal@redhat.com>
Fri, 24 Nov 2023 10:46:53 +0000 (11:46 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Fri, 24 Nov 2023 10:46:53 +0000 (11:46 +0100)
Fuzzer using `_cupsRasterExecPS()` found a way how to pass NULL into
`scan_ps()`, causing crash - we have to sanitize the argument for NULL
to fix it.

Fixes #831

cups/raster-interpret.c

index 4387876bf74eea8d9c74f12657df967ab0c581e0..45f2b224278f98113e7593a0b296192d1918fba5 100644 (file)
@@ -1047,6 +1047,8 @@ scan_ps(_cups_ps_stack_t *st,             /* I  - Stack */
   int                  parens;         /* Parenthesis nesting level */
 
 
+  if (!*ptr)
+    return (NULL);
  /*
   * Skip leading whitespace...
   */