tests: add an assert to avoid IPC blocking

If so much data is being sent over the internal IPC pipe that the pipe
buffer fills and the syscall blocks, the program will hang. Add an
assert to ensure that this limit is never reached. The buffer size is
going to be different on different platforms, so choose 1KB which is
likely to be a reasonable lower bound on just about any system.
Currently, the maximum amount ever written is <100 bytes, so this should
provide plenty of headroom.

Spotted by Codex Security

Closes #21688
This commit is contained in:
Dan Fandrich 2026-05-04 20:48:52 -07:00
parent cce4d3b0ed
commit d3b04e5600

View file

@ -1336,6 +1336,7 @@ sub controlleripccall {
my $margs = freeze \@_;
# Send IPC call via pipe
length($margs) < 1000 || die "A large IPC write risks blocking on some platforms";
my $err;
while(! defined ($err = syswrite($controllerw{$runnerid}, (pack "L", length($margs)) . $margs)) || $err <= 0) {
if((!defined $err && ! $!{EINTR}) || (defined $err && $err == 0)) {