Bug 691291 - Valgrind warning in gs_type0_next_char_glyph (gschar0.c:450)
Summary: Valgrind warning in gs_type0_next_char_glyph (gschar0.c:450)
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PS Interpreter (show other bugs)
Version: master
Hardware: PC Windows NT
: P4 minor
Assignee: Masaki Ushizaka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-11 03:14 UTC by Alex Cherepanov
Modified: 2010-05-19 11:22 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Cherepanov 2010-05-11 03:14:59 UTC
Valgrind reports access to uninitialized memory with
many files, for instance

valgrind gs -sDEVICE=nullpage -dNOPAUSE -dBATCH comparefiles/336-01.ps

The appears in the code added by the rev. 10603.
The uninitialized values, apparently, din't affect the output
files but it would be great to fix this anyway.

The bug can be easily observed by placing a breakpoint at gschar0.c:450
and examining the value of pte->fstack.items[fdepth].index .
Comment 1 Masaki Ushizaka 2010-05-18 12:29:42 UTC
I thought even pte->fstack.items[fdepth].index is not initialized, the effect was harmless,  i.e. the equivalent of 'if' block was already done and there is no harm to do that again.
However, several test I performed today indicates that there is a possibility of another path, and it may do it harmful way.
I will look into it and remove valgrind warnings.  Thank you Alex for pointing this out.
Comment 2 Masaki Ushizaka 2010-05-19 11:22:33 UTC
A fix is committed in r11281.

------------------------------------------------------------------------
r11281 | masaki | 2010-05-19 19:09:05 +0900 (Wed, 19 May 2010) | 9 lines

Bug 691291. Fix reading uninitialized memory.

The change I made in r10603 had a problem comparing with
uninitialized data when using Roman fonts.
The side effect was slowing down font rendering a little.
In this change I added extra initializer and made 
intention of the 'if' condition more clear.
No difference on outputs expected nor observed by localcluster
tests.
------------------------------------------------------------------------

If you still find more errors, please reopen this bug and assign to me.