Summary: | GS errors out when proccessing pdf with long path | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Till Kamppeter <till.kamppeter> |
Component: | General | Assignee: | Chris Liddell (chrisl) <chris.liddell> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | basil.semuonov, henry.stiles, konrad.blawat |
Priority: | P2 | ||
Version: | 9.06 | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- |
Description
Till Kamppeter
2012-10-12 10:13:47 UTC
The problem is actually in processing "-sOutputFile" command line parameter. File ./base/gsparam2.c contains a define: #define MAX_PARAM_KEY 255 so if length of path -sOutputFile > MAX_PARAM_KEY security check performed: gsparam2.c:73 --- char string_key[MAX_PARAM_KEY + 1]; if (sizeof(string_key) < key.size + 1) { code = gs_note_error(gs_error_rangecheck); break; } --- Seems not a bug, but a strong restriction for input arguments, and "magic" numbers in code. *** Bug 694076 has been marked as a duplicate of this bug. *** I'm hopeful that this is fixed with: http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=fe0b8fcf but it's possible there are areas of the code which make assumptions.... (In reply to comment #3) > I'm hopeful that this is fixed with: Length is fixed, but patch is incorrect and contain error at gs/base/gsparam2.c type of 'string_key' changed from 'char[MAX_PARAM_KEY + 1]' to 'char *' and condition checks 'sizeof(string_key)' which leads to wrong behaviour. |