Bug #687958 gswin32: Assertion fails due to a bug in dwtext.c
"Russell Lang" <[email protected]> Fri, 04 Mar 2005 19:46:10 +1100
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <4228BB02.18582.2EDFA50E@localhost> |
I could reproduce the assert by compiling with MSVC 2005 and using "debugbin\gswin32 -c X" where X had the top bit set. After patching, the assert did not occur, giving the same result as gswin32c.exe. Log Message: Fix bug #687958 gswin32: Assertion fails due to a bug in dwtext.c. Keep argument to isprint() within 0-255. Russell Lang [email protected] Ghostgum Software Pty Ltd http://www.ghostgum.com.au/ _______________________________________________ gs-code-review mailing list [email protected] http://www.ghostscript.com/mailman/listinfo/gs-code-review
dwtext1.txt
(application/octet-stream, 833 B)
diff -u cvs/gs/src/dwtext.c src/dwtext.c
--- l:/cvs/gs/src/dwtext.c Mon Apr 22 07:32:54 2002
+++ src/dwtext.c Fri Mar 04 08:32:28 2005
@@ -446,7 +446,8 @@
while (cnt>0) {
p = tw->ScreenBuffer + tw->CursorPos.y*tw->ScreenSize.x + tw->CursorPos.x;
limit = tw->ScreenSize.x - tw->CursorPos.x;
- for (count=0; (count < limit) && (cnt>0) && (isprint(*str) || *str=='\t'); count++) {
+ for (count=0; (count < limit) && (cnt>0) &&
+ (isprint((unsigned char)(*str)) || *str=='\t'); count++) {
if (*str=='\t') {
for (n = 8 - ((tw->CursorPos.x+count) % 8); (count < limit) & (n>0); n--, count++ )
*p++ = ' ';
@@ -467,7 +468,7 @@
str++;
cnt--;
}
- else if (!isprint(*str) && *str!='\t') {
+ else if (!isprint((unsigned char)(*str)) && *str!='\t') {
text_putch(tw, *str++);
cnt--;
}