Bug 2081 - Wrong argument types in declaration and realisation (tested on XSetScreenSaver())
Summary: Wrong argument types in declaration and realisation (tested on XSetScreenSave...
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: unspecified
Hardware: All All
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-15 08:08 UTC by Sir Raorn
Modified: 2007-08-31 17:33 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Sir Raorn 2004-12-15 08:08:59 UTC
Rumours says, that XSetScreenSaver() accepts int's as timeout and interval
arguments.  In fact, these values are limited to signed short int:

xc/lib/X11/SetSSaver.c:
int
XSetScreenSaver(dpy, timeout, interval, prefer_blank, allow_exp)
    register Display *dpy;
    int timeout, interval, prefer_blank, allow_exp;

{
    register xSetScreenSaverReq *req;

    LockDisplay(dpy);
    GetReq(SetScreenSaver, req);
    req->timeout = timeout;
    req->interval = interval;
    req->preferBlank = prefer_blank;
    req->allowExpose = allow_exp;
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}

xc/include/Xproto.h:
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length B16;
    INT16 timeout B16, interval B16;
    BYTE preferBlank, allowExpose;
    CARD16 pad2 B16;
} xSetScreenSaverReq;

INT16 and B16 are defined in xc/include/Xmd.h

Steps to reproduce:
$ xset s 43200 0
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  107 (X_SetScreenSaver)
  Value in failed request:  0xffffa8c0
  Serial number of failed request:  8
  Current serial number in output stream:  9

43200 - timeout value (12 hours),  0xffffa8c0 - 43200 (0x0000a8c0) threated as
signed short value.
Comment 1 Adam Jackson 2006-04-04 23:05:57 UTC
can't really change the function signature, so this is really a doc bug against
Xlib.
Comment 2 Sir Raorn 2006-04-05 01:16:48 UTC
Can xSetScreenSaverReq.timeout and xSetScreenSaverReq.interval be safely changed
to unsigned?  Or XSetScreenSaver() should check it's arguments...
Comment 3 Daniel Stone 2007-02-27 01:24:49 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 4 Eric Anholt 2007-08-31 17:33:08 UTC
Manpage note about this issue is pushed.  Clearing blocker status, since I don't think it is a legitimate blocker anyway.


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.