Bug 10846 - wrong XF86VidModeGetMonitor description
Summary: wrong XF86VidModeGetMonitor description
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: * Other (show other bugs)
Version: 7.2 (2007.02)
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: xorg-7.4
  Show dependency treegraph
 
Reported: 2007-05-03 07:58 UTC by Werner Meisner
Modified: 2008-03-24 12:13 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Werner Meisner 2007-05-03 07:58:40 UTC
from  the man-page of XF86VidModeGetMonitor:

  MONITOR FUNCTIONS
       Information  known  to the server about the monitor is returned by the XF
       function.  The hsync and vsync fields each point to an array of XF86VidMo
       tures.   The arrays contain nhsync and nvsync elements, respectively.  Th
       will be equal if a discreate value was given in the XF86Config file.

       The vendor, model, hsync, and vsync fields  point  to  dynamically  alloc
       should be freed by the caller.

dynamically allocated ??
not really

from XF86VMode.c

    if (rep.vendorLength)
        _XReadPad(dpy, monitor->vendor, rep.vendorLength);
    else
        monitor->vendor = "";
    if (rep.modelLength)
        _XReadPad(dpy, monitor->model, rep.modelLength);
    else
        monitor->model = "";
        
a pointer to a static "" is not dynamically!!
so

    XF86VidModeGetMonitor(dpy, DefaultScreen(dpy), &monitor)

    XFree(monitor.vendor);   -> crash
    XFree(monitor.model);    -> crash



were does the problem arise: xdpyinfo

   [...]
   XFree86-VidModeExtension version 2.2 opcode: 134, base error: 130
     Monitor Information:
       Vendor: , Model: 
       Num hsync: 1, Num vsync: 1
       hsync range 0:  30.00 -  70.00
       vsync range 0:  47.00 -  85.00
   *** glibc detected *** ./xdpyinfo: munmap_chunk(): invalid pointer: 0xb7ec794
Comment 1 Adam Jackson 2008-03-24 12:13:54 UTC
Fixed in git, thanks!


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.