Snarfsize calculation in X11's devdraw is only correct for 32-bit longs

Issue #113 new
created an issue
src/cmd/devdraw/x11-itrans.c:429:   XGetWindowProperty(_x.display, _x.drawable, prop, 0, SnarfSize/sizeof(ulong), 0, 
src/cmd/devdraw/x11-itrans.c:430:       AnyPropertyType, &type, &fmt, &len, &dummy, &xdata);

_xgetsnarffrom() uses XGetWindowProperty() with the intent of requesting SnarfSize bytes. To achieve this, it uses "SnarfSize/sizeof(ulong)" as the "long_length" argument - which seems reasonable, as it is the number of longs that fit in SnarfSize.

However, XGetWindowProperty(3) says that long_length "Specifies the length in 32-bit multiples of the data to be retrieved". Therefore, when longs are 64-bits, only half the snarf buffer can be retrieved from X11.

In tangentially related news, trying to open an issue from 404s.

Comments (0)

  1. Log in to comment