Bug 688913

Summary: Valgrind: Unidentified pointer in pdf_write_cmap() - not suppressed
Product: Ghostscript Reporter: Alex Cherepanov <alex>
Component: PDF WriterAssignee: Default assignee <ghostpdl-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---

Description Alex Cherepanov 2006-09-24 04:39:23 UTC
Valgrind reports passing a pointer to uninitialised memory to write()
system call. The stack trace includes the names from CRTL and
cannot be suppressed in platform-independent way.

File: Bug687698.ps - pdfwrite
Syscall param write(buf) points to uninitialised byte(s)
    at 0x4263D98: write (in /lib/libc-2.3.2.so)
    by 0x4203F3D: (within /lib/libc-2.3.2.so)
    by 0x4203ED5: _IO_do_write (in /lib/libc-2.3.2.so)
    by 0x4204B46: _IO_file_sync (in /lib/libc-2.3.2.so)
    by 0x41F9AFB: fflush (in /lib/libc-2.3.2.so)
    by 0x80EACC3: s_file_write_flush (sfxstdio.c:386)
    by 0x81FEEE9: cos_stream_contents_write (gdevpdfo.c:1323)
    by 0x81FF0BA: cos_stream_write (gdevpdfo.c:1365)
    by 0x81FD1E7: cos_write (gdevpdfo.c:221)
    by 0x81FD24C: cos_write_object (gdevpdfo.c:233)
    by 0x8205160: pdf_end_data (gdevpdfu.c:1811)
    by 0x8220467: pdf_write_cmap (gdevpdtw.c:789)
  Address 0x4022015 is not stack'd, malloc'd or (recently) free'd
{
   <insert a suppression name here>
   Memcheck:Param
   write(buf)
   fun:write
   obj:/lib/libc-2.3.2.so
   fun:_IO_do_write
   fun:_IO_file_sync
   fun:fflush
   fun:s_file_write_flush
   fun:cos_stream_contents_write
   fun:cos_stream_write
   fun:cos_write
   fun:cos_write_object
   fun:pdf_end_data
   fun:pdf_write_cmap
}
Comment 1 Alex Cherepanov 2006-09-25 11:40:37 UTC
It is well known that Valgrind doesn't report movement or calculations with
uninitialised data - only jumps that depend on them and some system calls.

In this case, uninitialised data are detected when fflush() CRTL function
calls write() system call. The data were copied to the file buffer earlier.
The offending bytes in the buffer are a PDF font subset prefixes, which indicates
that the prefix was calculated from a (partly) uninitialised object body.

Comment 2 Alex Cherepanov 2006-09-26 04:26:22 UTC

*** This bug has been marked as a duplicate of 688911 ***