[PATCH libXi] SizeClassInfo can return 0 even without an error

Emil Velikov emil.l.velikov at gmail.com
Sun Oct 9 14:34:28 UTC 2016


Hi Niels,

On Friday, 7 October 2016, Niels Ole Salscheider <
niels_ole at salscheider-online.de> wrote:

> Catch the error case separately. This fixes a few crashes on my computer.
>
> Signed-off-by: Niels Ole Salscheider <niels_ole at salscheider-online.de
> <javascript:;>>
> ---
>  src/XListDev.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/src/XListDev.c b/src/XListDev.c
> index f850cd0..d0c6bf2 100644
> --- a/src/XListDev.c
> +++ b/src/XListDev.c
> @@ -73,27 +73,27 @@ static int pad_to_xid(int base_size)
>      return ((base_size + padsize - 1)/padsize) * padsize;
>  }
>
> -static size_t
> -SizeClassInfo(xAnyClassPtr *any, size_t len, int num_classes)
> +static int
> +SizeClassInfo(xAnyClassPtr *any, size_t len, int num_classes, size_t
> *size)
>  {
> -    int size = 0;
>      int j;
> +    *size = 0;


No function should alter the contents of the arguments in case of an error.
For your other libXi patch one might want to fix the callers, if applicable.

If possible please mention a bug report/link or a bit more about how you
hit this. Wondering how it has gone unnoticed for so long.

That aside, nicely spotted !
Emil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-devel/attachments/20161009/4c33d474/attachment.html>


More information about the xorg-devel mailing list