Bug 4113

Summary: Missing check for NULL filename
Product: cairo Reporter: kent worsnop <kworsnop>
Component: freetype font backendAssignee: Owen Taylor <otaylor>
Status: RESOLVED DUPLICATE QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high    
Version: 0.9.3   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Proposed patch for cairo-ft-font.c

Description kent worsnop 2005-08-16 10:11:45 UTC
When calculating the hash for filename in _cairo_ft_unscaled_font_init_key 
there is a missing check for a NULL filename.[line 260 in cairo-ft-font.c] 
A workaround for a NULL filename could be 
 if (filename!=NULL) {
    hash = _cairo_hash_string (filename);
 }
 else {
     snprintf(tmp,12,"cairoXXXXXX");
      mkstemp(tmp);
      hash = _cairo_hash_string (tmp);
 }
Comment 1 kent worsnop 2005-08-16 10:14:05 UTC
Created attachment 2898 [details] [review]
Proposed patch for cairo-ft-font.c
Comment 2 kent worsnop 2005-08-16 10:22:49 UTC
Note the attached patch is wrong as it uses mkstemp and not mktemp.  Also the
use of mktemp needs to be checked for NULL returns.  Another method would be to
generate a random number when filename==NULL;
Comment 3 Carl Worth 2005-08-16 11:42:28 UTC
We don't need to hash NULL strings uniquely. But the more fundamental
issue is that we never need to do any hashing at all when the
filename is NULL.

*** This bug has been marked as a duplicate of 4110 ***
Comment 4 Carl Worth 2005-08-22 17:14:48 UTC
Move bugs against "cvs" version to "0.9.3" so we can remove the "cvs" version.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.