[gs-devel] Fix: make check_param_string() respect 'is_valid'
giles at artifex.com
Tue Oct 29 15:31:20 PST 2002
This came up in debugging 630542. The macro param_check_string() is
gsdparam.c simply wraps param_check_bytes, adding a buffer length
argument calculated from strlen(). However, both take an 'is_valid'
parameter, which in the case of the offending (gsdparam:638) is
explicitly set to a NULL check. Thus is the string for comparison is
NULL, param_check_string() will ignore the 'is_valid' argument and call
strlen(NULL) resulting in a segfault.
The attached patch makes param_check_string() a function and has it
check is_valid, turing the sefault into an error (if a typically opaque
The exact meaning of is_valid isn't documented, so perhaps a more
aggressive second check for NULL pointer is reasonable. Comments?
Proposed log message:
Fix: param_check_string now checks is_valid before trying to calculate
the length of the string in question.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1633 bytes
Desc: not available
Url : http://ghostscript.com/pipermail/gs-devel/attachments/20021029/fb5d3418/param_check_string.obj
More information about the gs-devel