gh-124621: Emscripten: Fix regression in use-after-close error handling (#136837)
Some checks are pending
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run

This commit is contained in:
Hood Chatham 2025-07-19 21:43:50 +02:00 committed by GitHub
parent 69ea1b3a8f
commit 800d37feca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -148,10 +148,17 @@ EM_JS_MACROS(__externref_t, __maybe_fd_read_async, (
size_t iovcnt,
__wasi_size_t *nread
), {
var stream = SYSCALLS.getStreamFromFD(fd);
if (!WebAssembly.promising) {
return null;
}
var stream;
try {
stream = SYSCALLS.getStreamFromFD(fd);
} catch (e) {
// If the fd was already closed or never existed, getStreamFromFD()
// raises. We'll let fd_read_orig() handle setting errno.
return null;
}
if (!stream.stream_ops.readAsync) {
// Not an async device. Fall back to __wasi_fd_read_orig().
return null;