From 497e112ffef4a20700c6cba08ee4a74b091a72cb Mon Sep 17 00:00:00 2001 From: Nedunchezhiyan-M Date: Wed, 8 Apr 2026 23:17:45 +0530 Subject: [PATCH] Fix potential crash in FileReader.readAsArrayBuffer on malformed data URL When reading as ArrayBuffer, the code splits the data URL on "," and accesses index [1] without a fallback. If the native module returns a string without a comma, this results in undefined being passed to toByteArray(), causing a crash. Added nullish coalescing to default to an empty string. --- packages/react-native/Libraries/Blob/FileReader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Blob/FileReader.js b/packages/react-native/Libraries/Blob/FileReader.js index 9cb37e5ca487..4e2ea12d80f3 100644 --- a/packages/react-native/Libraries/Blob/FileReader.js +++ b/packages/react-native/Libraries/Blob/FileReader.js @@ -86,7 +86,7 @@ class FileReader extends EventTarget { return; } - const base64 = text.split(',')[1]; + const base64 = text.split(',')[1] ?? ''; const typedArray = toByteArray(base64); this._result = typedArray.buffer;