Reviewed-by: Jeremy Huddleston <[email protected]> Tested-by: Jeremy Huddleston <[email protected]>
On Mar 14, 2012, at 7:06 PM, Peter Hutterer <[email protected]> wrote: > Regression introduced in c1a5a70b51f12dedf354102217c7cd4247ed3a4b. > > If double-padding is applied, the length of the mask on the wire may be > smaller than libXi's mask_len. When copying, only the wire length must be > copied, with the remainder set to 0. > When advancing to the button labels, the wire length matters, not libXi's > internal length. > > Reported-by: Jeremy Huddleston <[email protected]> > Signed-off-by: Peter Hutterer <[email protected]> > --- > I think this one should fix the issue. You're seeing this because > the ifs in pad_to_double get triggered on your box, but not on mine. That's > a separate issue I guess, shouldn't trigger on OS X. nonetheless, this bug > would be present on MIPS N32 too. > > src/XExtInt.c | 11 +++++++++-- > 1 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/src/XExtInt.c b/src/XExtInt.c > index 89c0894..0c64f9a 100644 > --- a/src/XExtInt.c > +++ b/src/XExtInt.c > @@ -1610,12 +1610,14 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int > *nclasses) > int struct_size; > int state_size; > int labels_size; > + int wire_mask_size; > > cls_wire = (xXIButtonInfo*)any_wire; > sizeXIButtonClassType(cls_wire->num_buttons, > &struct_size, &state_size, > &labels_size); > cls_lib = next_block(&ptr_lib, struct_size); > + wire_mask_size = ((cls_wire->num_buttons + 7)/8 + 3)/4 * > 4; > > cls_lib->type = cls_wire->type; > cls_lib->sourceid = cls_wire->sourceid; > @@ -1623,10 +1625,14 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int > *nclasses) > cls_lib->state.mask_len = state_size; > cls_lib->state.mask = next_block(&ptr_lib, state_size); > memcpy(cls_lib->state.mask, &cls_wire[1], > - cls_lib->state.mask_len); > + wire_mask_size); > + if (state_size != wire_mask_size) > + memset(&cls_lib->state.mask[wire_mask_size], 0, > + state_size - wire_mask_size); > > cls_lib->labels = next_block(&ptr_lib, labels_size); > - atoms =(uint32_t*)((char*)&cls_wire[1] + > cls_lib->state.mask_len); > + > + atoms =(uint32_t*)((char*)&cls_wire[1] + wire_mask_size); > for (j = 0; j < cls_lib->num_buttons; j++) > cls_lib->labels[j] = *atoms++; > > -- > 1.7.7.6 > > _______________________________________________ > [email protected]: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel > _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
