mirror of
https://github.com/curl/curl.git
synced 2026-07-28 06:33:06 +03:00
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:
parent
cce4d3b0ed
commit
d3b04e5600
1 changed files with 1 additions and 0 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue