RFR: 6478546: FileInputStream.read() throws OutOfMemoryError when there is plenty available [v2]

Sergey Tsypanov stsypanov at openjdk.org
Thu Jul 27 19:44:40 UTC 2023


On Thu, 27 Jul 2023 16:59:58 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Then I guess we don't need this `if`-clause
>
> Then I think one gets an error if `0 < len < BUF_SIZE`:
> 
> 
> $ cat free.c
> #include <stdlib.h>
> 
> int main(int argc, char** argv)
> {
>     char stackBuf[8];
>     char* buf;
> 
>     buf = stackBuf;
>     free(buf);
> }
> bpb:test{175}$ ./free
> free(14365,0x10e6a1600) malloc: *** error for object 0x7ff7b7d38280: pointer being freed was not allocated
> free(14365,0x10e6a1600) malloc: *** set a breakpoint in malloc_error_break to debug
> Abort trap: 6
> 
> This is on macOS.

Right!

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14981#discussion_r1276747895


More information about the security-dev mailing list