On Tue, Jun 27, 2017 at 06:10:08PM +0800, JingPiao Chen wrote:
[...]
> +static bool
> +decode_meminfo(struct tcb *tcp, kernel_ulong_t addr,
> +            kernel_ulong_t len, void *const opaque_data)
> +{
> +     uint32_t mem;
> +     int nmemb = len / sizeof(mem);
> +
> +     if (!nmemb)
> +             return false;
> +
> +     if (nmemb > SK_MEMINFO_VARS)
> +             nmemb = SK_MEMINFO_VARS;
> +
> +     print_array(tcp, addr, nmemb, &mem, sizeof(mem),
> +                 umoven_or_printaddr, print_meminfo, 0);
> +
> +     return true;
> +}

The type of "nmemb" should be size_t.

Imagine len == 2^34-4, then nmemb == 2^32-1, and if nmemb is a signed int,
then nmemb == -1, and -1UL is passed to print_array.


-- 
ldv

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to