iOS: a request body read comes back as one uncapped frame, and a body past V8's string limit crashes the tool-server
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- ios, node.js, typescript
- Domain
- backend, mobile-dev
Research direction
Start in native-devtools.ts around line 1086, where the iOS NDJSON reader is created without maxFrameChars, and compare it with the Android reader that passes the cap. Then read attachNdjsonReader to see how frames are accumulated with buf += chunk. Done means the iOS reader gets a frame cap that matches the response-body limit and an oversized body no longer crashes the tool-server, which you can check by reproducing with a large request body.
Written by the indexing model from the issue text.
Description
[Diplomat, Opus 5.5]: Found while reviewing #1887.
Problem
A request body read on iOS comes back as one NDJSON frame, whatever the size of the body. The library collects an uploaded body stream with no cap, while it cuts response bodies at 1 MiB. The tool-server's reader for the iOS library is created without maxFrameChars (native-devtools.ts:1086), so attachNdjsonReader builds the whole frame as one string.
Past V8's string limit, buf += chunk throws RangeError: Invalid string length in the socket's data handler. The error reaches uncaughtException, and index.ts:137 shuts the tool-server down.
Repro
I reproduced this on a Mac app with #1887, which uses the same library file and the same reader factory (macos-app.ts:427):
- A 45 MB request body read takes 2.9 s. A 100 MB body takes 14.5 s, and the app's other library calls time out meanwhile.
- A 410 MB binary upload, read while it is uploading, crashes the tool-server with that
RangeError.
On iOS I traced this but did not run it: the library code and the reader are the same.
Impact
One large upload in the app under test can stop the tool-server, and with it every session that uses it.
Related: #1497 (the same reader is quadratic in frame size) and #1055 (the frame cap exists, but only the Android reader passes it). The Mac side is raised on #1887.
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 154
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 88
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from software-mansion/argent
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
software-mansion/argent#1946 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
software-mansion/argent#1940 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
software-mansion/argent#1931 ·
Maintainers usually reply within 1 day
-
b:nitpick
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
software-mansion/argent#1930 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
software-mansion/argent#1929 ·
Maintainers usually reply within 1 day
All issues in software-mansion/argent
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 2 days
-
nip98: validateEvent skips the payload check for a string or bytes bodyMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nbd-wtf/nostr-tools#599 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LemmyNet/lemmy-ui#4442 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Zettlr/Zettlr#6664 · 1 comment ·
Maintainers usually reply within 1 day
-
Microsoft Outlook add attachment reads the binary field from item 0Possibly taken @joshbarros claimed this today. Openstatus:in-linear
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
n8n-io/n8n#44021 · 2 comments ·
Maintainers usually reply within 1 day