Bug 37746

Summary: cairo trace _init_logfile uses buf past its scope
Product: cairo Reporter: Andre Klapper <a9016009>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: minor    
Priority: medium Keywords: patch
Version: 1.10.3   
Hardware: Other   
OS: All   
See Also: https://bugs.meego.com/show_bug.cgi?id=14663
Whiteboard:
i915 platform: i915 features:

Description Andre Klapper 2011-05-30 07:13:32 UTC
Upstreaming from https://bugs.meego.com/show_bug.cgi?id=14663 .

From http://cgit.freedesktop.org/cairo/tree/util/cairo-trace/trace.c :

777 _init_logfile (void)
778 {
780     const char *filename;
819     filename = getenv ("CAIRO_TRACE_OUTFILE_EXACT");
820     if (filename == NULL) {
821         char buf[4096], name[4096] = "";
834         filename = buf;
837     }
839     logfile = fopen (filename, "wb");

while this is likely to work, there's no requirement that it do so.

PATCH:
https://bugs.meego.com/attachment.cgi?id=4996&action=diff
Comment 1 Andre Klapper 2011-05-31 14:23:16 UTC
Patch was submitted by Josh Soref, by the way.
Comment 2 Chris Wilson 2011-06-06 07:11:09 UTC
commit 61fd10376fd89a0c5aa504924594d12fa9899b80
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jun 6 15:05:51 2011 +0100

    cairo-trace: Fix use of buf outside of scope
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37746
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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.