[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][xorg-team/lib/libxi][debian-unstable] 10 commits: Fix double alignment on 32bits machines with strict constraints



Title: GitLab

Timo Aaltonen pushed to branch debian-unstable at X Strike Force / lib / libxi

Commits:

  • 09f3eb57
    by Matthieu Herrb at 2023-08-05T10:32:03+00:00
    Fix double alignment on 32bits machines with strict constraints
    
  • a340bc04
    by Alan Coopersmith at 2023-10-13T11:17:43-07:00
    gitlab CI: Update to latest CI templates
    
    Current template fails to rebuild the CI container with the current
    Debian stable release (a new release since the last update)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    
  • 57ce2e8b
    by Peter Hutterer at 2024-01-29T11:27:32+10:00
    Allow XIFreeDeviceInfo on a null pointer
    
  • 56b11459
    by kyomawolf at 2024-03-18T22:02:57+00:00
    fixed wrong type in man page
    
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxi/-/merge_requests/14>
    
  • dabce4db
    by Alan Coopersmith at 2024-08-26T11:52:00-07:00
    wireTo*Event: check for malloc() failure
    
    Fixes 6 -Wanalyzer-possible-null-dereference and
    1 -Wanalyzer-null-dereference and warnings from gcc 14.1
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxi/-/merge_requests/17>
    
  • a5af26c6
    by Peter Hutterer at 2024-08-27T11:11:22+10:00
    XGetFeedbackControl: skip over unknown feedback controls
    
    If the server sends an unknown feedback control class we would allocate
    the amount of *protocol* bytes for the client representation but then
    later mess up the actual composition of the classes due to
    Feedback->length never being initialized.
    
    So while in theory it looks like this:
       |-------------- allocated size -----------------|
       [led feedback] [ ?unknown? ] [kbd feedback][....]
    with unknown being the size of the class on the protocol,
    in practice it looks like this:
       |-------------- allocated size -----------------|
       [led feedback] [ ?unknown?                ] [kbd feedback][...]
    with unknown being the size of whatever was in the Feeback->length
    pointed to at the time. The content of unknown is never initialized.
    
    Fix this by making unknown classes disappear so the above becomes:
       |------- allocated size ---------|
       [led feedback][kbd feedback][....]
    
    Closes #16
    
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxi/-/merge_requests/18>
    
  • 3c2d5aed
    by Peter Hutterer at 2024-09-05T11:15:04+10:00
    libXi 1.8.2
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    
  • d1ec95c4
    by Timo Aaltonen at 2024-09-25T10:44:40+03:00
    Merge branch 'upstream-unstable' into debian-unstable
    
  • 31c67320
    by Timo Aaltonen at 2024-09-25T10:48:58+03:00
    version bump
    
  • 4ca8eb53
    by Timo Aaltonen at 2024-09-25T10:49:05+03:00
    releasing package libxi version 2:1.8.2-1
    

7 changed files:

Changes:

  • .gitlab-ci.yml
    1 1
     # vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
    
    2 2
     
    
    3
    -.templates_sha: &template_sha 16f790f93f893394b70d7048fb0e8a981ceaa3c5 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
    
    3
    +.templates_sha: &template_sha 185ede0e9b9b1924b92306ab8b882a6294e92613 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
    
    4 4
     
    
    5 5
     include:
    
    6 6
       - project: 'freedesktop/ci-templates'
    
    ... ... @@ -19,7 +19,7 @@ stages:
    19 19
       - deploy
    
    20 20
     
    
    21 21
     variables:
    
    22
    -  FDO_DISTRIBUTION_TAG: '2021-05-30.8'  # change this to rebuild the images
    
    22
    +  FDO_DISTRIBUTION_TAG: '2023-10-13.0'  # change this to rebuild the images
    
    23 23
       FDO_UPSTREAM_REPO: 'xorg/lib/libxi'
    
    24 24
       FDO_DISTRIBUTION_VERSION: 'stable'
    
    25 25
       FDO_DISTRIBUTION_PACKAGES: 'git ca-certificates meson g++ make xutils-dev autoconf automake libtool pkg-config xmlto xorg-sgml-doctools w3m xsltproc libx11-dev libxext-dev libxfixes-dev'
    

  • configure.ac
    1 1
     
    
    2 2
     # Initialize Autoconf
    
    3 3
     AC_PREREQ([2.60])
    
    4
    -AC_INIT([libXi], [1.8.1],
    
    4
    +AC_INIT([libXi], [1.8.2],
    
    5 5
     	[https://gitlab.freedesktop.org/xorg/lib/libXi/issues], [libXi])
    
    6 6
     AC_CONFIG_SRCDIR([Makefile.am])
    
    7 7
     AC_CONFIG_HEADERS([src/config.h])
    

  • debian/changelog
    1
    +libxi (2:1.8.2-1) unstable; urgency=medium
    
    2
    +
    
    3
    +  * New upstream release.
    
    4
    +
    
    5
    + -- Timo Aaltonen <tjaalton@debian.org>  Wed, 25 Sep 2024 10:48:59 +0300
    
    6
    +
    
    1 7
     libxi (2:1.8.1-1) unstable; urgency=medium
    
    2 8
     
    
    3 9
       [ Timo Aaltonen ]
    

  • man/XGetDeviceProperty.txt
    ... ... @@ -32,7 +32,7 @@ SYNOPSIS
    32 32
                                    Atom type,
    
    33 33
                                    int format,
    
    34 34
                                    int mode,
    
    35
    -                               const char *data,
    
    35
    +                               const unsigned char *data,
    
    36 36
                                    int nelements)
    
    37 37
     
    
    38 38
        void XDeleteDeviceProperty( Display *display,
    

  • src/XExtInt.c
    ... ... @@ -1428,16 +1428,18 @@ copyRawEvent(XGenericEventCookie *cookie_in,
    1428 1428
         in = cookie_in->data;
    
    1429 1429
     
    
    1430 1430
         bits = count_bits(in->valuators.mask, in->valuators.mask_len);
    
    1431
    -    len = sizeof(XIRawEvent) + in->valuators.mask_len;
    
    1431
    +    len = pad_to_double(sizeof(XIRawEvent))
    
    1432
    +        + pad_to_double(in->valuators.mask_len);
    
    1432 1433
         len += bits * sizeof(double) * 2;
    
    1433 1434
     
    
    1434 1435
         ptr = cookie_out->data = malloc(len);
    
    1435 1436
         if (!ptr)
    
    1436 1437
             return False;
    
    1437 1438
     
    
    1438
    -    out = next_block(&ptr, sizeof(XIRawEvent));
    
    1439
    +    out = next_block(&ptr, pad_to_double(sizeof(XIRawEvent)));
    
    1439 1440
         *out = *in;
    
    1440
    -    out->valuators.mask = next_block(&ptr, out->valuators.mask_len);
    
    1441
    +    out->valuators.mask
    
    1442
    +        = next_block(&ptr, pad_to_double(out->valuators.mask_len));
    
    1441 1443
         memcpy(out->valuators.mask, in->valuators.mask, out->valuators.mask_len);
    
    1442 1444
     
    
    1443 1445
         out->valuators.values = next_block(&ptr, bits * sizeof(double));
    
    ... ... @@ -1595,6 +1597,8 @@ wireToDeviceEvent(xXIDeviceEvent *in, XGenericEventCookie* cookie)
    1595 1597
         len = sizeDeviceEvent(in->buttons_len * 4, in->valuators_len * 4, ptr);
    
    1596 1598
     
    
    1597 1599
         cookie->data = ptr_lib = malloc(len);
    
    1600
    +    if (!ptr_lib)
    
    1601
    +        return 0;
    
    1598 1602
     
    
    1599 1603
         out = next_block(&ptr_lib, sizeof(XIDeviceEvent));
    
    1600 1604
         out->display = cookie->display;
    
    ... ... @@ -1888,6 +1892,8 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie)
    1888 1892
         len = size_classes((xXIAnyInfo*)&in[1], in->num_classes);
    
    1889 1893
     
    
    1890 1894
         cookie->data = out = malloc(sizeof(XIDeviceChangedEvent) + len);
    
    1895
    +    if (!out)
    
    1896
    +        return 0;
    
    1891 1897
     
    
    1892 1898
         out->type = in->type;
    
    1893 1899
         out->serial = cookie->serial;
    
    ... ... @@ -1918,7 +1924,9 @@ wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie)
    1918 1924
         xXIHierarchyInfo *info_in;
    
    1919 1925
         XIHierarchyEvent *out;
    
    1920 1926
     
    
    1921
    -    cookie->data = out = malloc(sizeof(XIHierarchyEvent) + in->num_info * sizeof(XIHierarchyInfo));;
    
    1927
    +    cookie->data = out = malloc(sizeof(XIHierarchyEvent) + in->num_info * sizeof(XIHierarchyInfo));
    
    1928
    +    if (!out)
    
    1929
    +        return 0;
    
    1922 1930
     
    
    1923 1931
         out->info           = (XIHierarchyInfo*)&out[1];
    
    1924 1932
         out->display        = cookie->display;
    
    ... ... @@ -1954,7 +1962,8 @@ wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cook
    1954 1962
         XIRawEvent *out;
    
    1955 1963
         void *ptr;
    
    1956 1964
     
    
    1957
    -    len = sizeof(XIRawEvent) + in->valuators_len * 4;
    
    1965
    +    len = pad_to_double(sizeof(XIRawEvent))
    
    1966
    +        + pad_to_double(in->valuators_len * 4);
    
    1958 1967
         bits = count_bits((unsigned char*)&in[1], in->valuators_len * 4);
    
    1959 1968
         len += bits * sizeof(double) * 2; /* raw + normal */
    
    1960 1969
     
    
    ... ... @@ -1962,7 +1971,7 @@ wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cook
    1962 1971
         if (!ptr)
    
    1963 1972
             return 0;
    
    1964 1973
     
    
    1965
    -    out = next_block(&ptr, sizeof(XIRawEvent));
    
    1974
    +    out = next_block(&ptr, pad_to_double(sizeof(XIRawEvent)));
    
    1966 1975
         out->type           = in->type;
    
    1967 1976
         out->serial         = cookie->serial;
    
    1968 1977
         out->display        = cookie->display;
    
    ... ... @@ -1981,7 +1990,8 @@ wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cook
    1981 1990
             out->sourceid       = 0;
    
    1982 1991
     
    
    1983 1992
         out->valuators.mask_len = in->valuators_len * 4;
    
    1984
    -    out->valuators.mask = next_block(&ptr, out->valuators.mask_len);
    
    1993
    +    out->valuators.mask
    
    1994
    +        = next_block(&ptr, pad_to_double(out->valuators.mask_len));
    
    1985 1995
         memcpy(out->valuators.mask, &in[1], out->valuators.mask_len);
    
    1986 1996
     
    
    1987 1997
         out->valuators.values = next_block(&ptr, bits * sizeof(double));
    
    ... ... @@ -2012,6 +2022,9 @@ wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie)
    2012 2022
         len = sizeof(XIEnterEvent) + in->buttons_len * 4;
    
    2013 2023
     
    
    2014 2024
         cookie->data = out = malloc(len);
    
    2025
    +    if (!out)
    
    2026
    +        return 0;
    
    2027
    +
    
    2015 2028
         out->buttons.mask = (unsigned char*)&out[1];
    
    2016 2029
     
    
    2017 2030
         out->type           = in->type;
    
    ... ... @@ -2056,6 +2069,8 @@ wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie)
    2056 2069
         XIPropertyEvent *out = malloc(sizeof(XIPropertyEvent));
    
    2057 2070
     
    
    2058 2071
         cookie->data = out;
    
    2072
    +    if (!out)
    
    2073
    +        return 0;
    
    2059 2074
     
    
    2060 2075
         out->type           = in->type;
    
    2061 2076
         out->serial         = cookie->serial;
    
    ... ... @@ -2077,6 +2092,8 @@ wireToTouchOwnershipEvent(xXITouchOwnershipEvent *in,
    2077 2092
         XITouchOwnershipEvent *out = malloc(sizeof(XITouchOwnershipEvent));
    
    2078 2093
     
    
    2079 2094
         cookie->data = out;
    
    2095
    +    if (!out)
    
    2096
    +        return 0;
    
    2080 2097
     
    
    2081 2098
         out->type           = in->type;
    
    2082 2099
         out->serial         = cookie->serial;
    
    ... ... @@ -2102,6 +2119,8 @@ wireToBarrierEvent(xXIBarrierEvent *in, XGenericEventCookie *cookie)
    2102 2119
         XIBarrierEvent *out = malloc(sizeof(XIBarrierEvent));
    
    2103 2120
     
    
    2104 2121
         cookie->data = out;
    
    2122
    +    if (!out)
    
    2123
    +        return 0;
    
    2105 2124
     
    
    2106 2125
         out->display    = cookie->display;
    
    2107 2126
         out->type       = in->type;
    
    ... ... @@ -2133,6 +2152,8 @@ wireToPinchEvent(xXIGesturePinchEvent *in,
    2133 2152
         XIGesturePinchEvent *out;
    
    2134 2153
     
    
    2135 2154
         cookie->data = out = malloc(sizeof(XIGesturePinchEvent));
    
    2155
    +    if (!out)
    
    2156
    +        return 0;
    
    2136 2157
     
    
    2137 2158
         out->display    = cookie->display;
    
    2138 2159
         out->type       = in->type;
    
    ... ... @@ -2178,6 +2199,8 @@ wireToSwipeEvent(xXIGestureSwipeEvent *in,
    2178 2199
         XIGestureSwipeEvent *out;
    
    2179 2200
     
    
    2180 2201
         cookie->data = out = malloc(sizeof(XIGestureSwipeEvent));
    
    2202
    +    if (!out)
    
    2203
    +        return 0;
    
    2181 2204
     
    
    2182 2205
         out->display    = cookie->display;
    
    2183 2206
         out->type       = in->type;
    

  • src/XGetFCtl.c
    ... ... @@ -67,7 +67,7 @@ XFeedbackState *
    67 67
     XGetFeedbackControl(
    
    68 68
         register Display	*dpy,
    
    69 69
         XDevice		*dev,
    
    70
    -    int			*num_feedbacks)
    
    70
    +    int			*num_feedbacks_out)
    
    71 71
     {
    
    72 72
         XFeedbackState *Feedback = NULL;
    
    73 73
         XFeedbackState *Sav = NULL;
    
    ... ... @@ -77,6 +77,8 @@ XGetFeedbackControl(
    77 77
         xGetFeedbackControlReq *req;
    
    78 78
         xGetFeedbackControlReply rep;
    
    79 79
         XExtDisplayInfo *info = XInput_find_display(dpy);
    
    80
    +    int num_feedbacks = 0;
    
    81
    +    int known_feedbacks = 0;
    
    80 82
     
    
    81 83
         LockDisplay(dpy);
    
    82 84
         if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
    
    ... ... @@ -95,7 +97,7 @@ XGetFeedbackControl(
    95 97
     	size_t size = 0;
    
    96 98
     	int i;
    
    97 99
     
    
    98
    -	*num_feedbacks = rep.num_feedbacks;
    
    100
    +	num_feedbacks = rep.num_feedbacks;
    
    99 101
     
    
    100 102
     	if (rep.length < (INT_MAX >> 2)) {
    
    101 103
     	    nbytes = rep.length << 2;
    
    ... ... @@ -109,7 +111,7 @@ XGetFeedbackControl(
    109 111
     	end = (char *)f + nbytes;
    
    110 112
     	_XRead(dpy, (char *)f, nbytes);
    
    111 113
     
    
    112
    -	for (i = 0; i < *num_feedbacks; i++) {
    
    114
    +	for (i = 0; i < num_feedbacks; i++) {
    
    113 115
     	    if ((char *)f + sizeof(*f) > end ||
    
    114 116
     	        f->length == 0 || f->length > nbytes)
    
    115 117
     		goto out;
    
    ... ... @@ -141,7 +143,7 @@ XGetFeedbackControl(
    141 143
     		size += sizeof(XBellFeedbackState);
    
    142 144
     		break;
    
    143 145
     	    default:
    
    144
    -		size += f->length;
    
    146
    +		/* unknown classes are skipped */
    
    145 147
     		break;
    
    146 148
     	    }
    
    147 149
     	    if (size > INT_MAX)
    
    ... ... @@ -154,9 +156,11 @@ XGetFeedbackControl(
    154 156
     	    goto out;
    
    155 157
     
    
    156 158
     	Sav = Feedback;
    
    159
    +	known_feedbacks = num_feedbacks;
    
    157 160
     
    
    158 161
     	f = sav;
    
    159
    -	for (i = 0; i < *num_feedbacks; i++) {
    
    162
    +	for (i = 0; i < num_feedbacks; i++) {
    
    163
    +	    Bool skip = False;
    
    160 164
     	    switch (f->class) {
    
    161 165
     	    case KbdFeedbackClass:
    
    162 166
     	    {
    
    ... ... @@ -262,14 +266,18 @@ XGetFeedbackControl(
    262 266
     		break;
    
    263 267
     	    }
    
    264 268
     	    default:
    
    269
    +		--known_feedbacks;
    
    270
    +		skip = True;
    
    265 271
     		break;
    
    266 272
     	    }
    
    267 273
     	    f = (xFeedbackState *) ((char *)f + f->length);
    
    268
    -	    Feedback = (XFeedbackState *) ((char *)Feedback + Feedback->length);
    
    274
    +	    if (!skip)
    
    275
    +		Feedback = (XFeedbackState *) ((char *)Feedback + Feedback->length);
    
    269 276
     	}
    
    270 277
         }
    
    271 278
     out:
    
    272 279
         XFree((char *)sav);
    
    280
    +    *num_feedbacks_out = known_feedbacks;
    
    273 281
     
    
    274 282
         UnlockDisplay(dpy);
    
    275 283
         SyncHandle();
    

  • src/XIQueryDevice.c
    ... ... @@ -150,7 +150,7 @@ void
    150 150
     XIFreeDeviceInfo(XIDeviceInfo* info)
    
    151 151
     {
    
    152 152
         XIDeviceInfo *ptr = info;
    
    153
    -    while(ptr->name)
    
    153
    +    while(ptr && ptr->name)
    
    154 154
         {
    
    155 155
             Xfree(ptr->classes);
    
    156 156
             Xfree(ptr->name);
    


  • Reply to: