Bug 4113 - Missing check for NULL filename
Summary: Missing check for NULL filename
Status: RESOLVED DUPLICATE of bug 4110
Alias: None
Product: cairo
Classification: Unclassified
Component: freetype font backend (show other bugs)
Version: 0.9.3
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Owen Taylor
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-16 10:11 UTC by kent worsnop
Modified: 2005-08-22 00:14 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Proposed patch for cairo-ft-font.c (766 bytes, patch)
2005-08-16 10:14 UTC, kent worsnop
Details | Splinter Review

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.