mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Ensure io requests are always capped at 0x7ffff000
This gives us the Linux behavior across platforms. Fixes #1189
This commit is contained in:
parent
6cf9b9e0fc
commit
af3f62a71a
10 changed files with 268 additions and 81 deletions
|
@ -30,10 +30,14 @@ int setup(void) {
|
|||
return 2;
|
||||
if (pwrite(fd, "a", 1, 0) != 1)
|
||||
return 3;
|
||||
if (pwrite(fd, "z", 1, SIZE - 1) != 1)
|
||||
if (pwrite(fd, "b", 1, 0x7fffefff) != 1)
|
||||
return 4;
|
||||
if (close(fd))
|
||||
if (pwrite(fd, "c", 1, 0x7ffff000) != 1)
|
||||
return 5;
|
||||
if (pwrite(fd, "z", 1, SIZE - 1) != 1)
|
||||
return 6;
|
||||
if (close(fd))
|
||||
return 7;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -42,17 +46,21 @@ int test(void) {
|
|||
char *buf;
|
||||
size_t rc;
|
||||
if (!(f = fopen(path, "r")))
|
||||
return 6;
|
||||
if (!(buf = malloc(SIZE)))
|
||||
return 7;
|
||||
if ((rc = fread(buf, SIZE, 1, f)) != 1)
|
||||
return 8;
|
||||
if (buf[0] != 'a')
|
||||
if (!(buf = malloc(SIZE)))
|
||||
return 9;
|
||||
if (buf[SIZE - 1] != 'z')
|
||||
if ((rc = fread(buf, SIZE, 1, f)) != 1)
|
||||
return 10;
|
||||
if (fclose(f))
|
||||
if (buf[0] != 'a')
|
||||
return 11;
|
||||
if (buf[0x7fffefff] != 'b')
|
||||
return 12;
|
||||
if (buf[0x7ffff000] != 'c')
|
||||
return 13;
|
||||
if (buf[SIZE - 1] != 'z')
|
||||
return 14;
|
||||
if (fclose(f))
|
||||
return 15;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue