emacs-devel
[Top][All Lists]
Advanced

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

Re: oops? read/write vs type of length parameter


From: David Kastrup
Subject: Re: oops? read/write vs type of length parameter
Date: Mon, 11 Apr 2011 14:31:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Jim Meyering <address@hidden> writes:

> What about when EMACS_INT is defined to "int"?
>
> Someone will inevitably call your write-like function
> with a length of type size_t -- many existing uses do just that --
> and by using a signed type, you will have converted their long
> yet valid (2-4GiB), buffer length, into a negative number.

Resulting in an error or nothing happening.  In contrast, if a negative
number is turned into a long yet valid (2-4GiB) number, it is very
likely that unintended memory areas will get stomped over.

-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]