win: replace hardcoded stdio count cap with overflow check
The existing check rejected stdio_count > 255 with an arbitrary limit. Replace it with a SIZE_MAX-based overflow guard matching the approach used on Unix, so the allocation in CHILD_STDIO_SIZE(count) cannot wrap.
This commit is contained in:
parent
2ad3e071c3
commit
0be2a8f9c8
@ -175,8 +175,9 @@ int uv__stdio_create(uv_loop_t* loop,
|
||||
|
||||
count = options->stdio_count;
|
||||
|
||||
if (count < 0 || count > 255) {
|
||||
/* Only support FDs 0-255 */
|
||||
if (count < 0 ||
|
||||
(size_t) count > (SIZE_MAX - sizeof(int)) /
|
||||
(sizeof(unsigned char) + sizeof(uintptr_t))) {
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
} else if (count < 3) {
|
||||
/* There should always be at least 3 stdio handles. */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user