Closed papandreou closed 4 years ago
@devongovett, ping?
I have an image that crashes node due to out of memory error when using this library to parse its EXIF data. This PR fixes that.
<--- Last few GCs --->
[1902:0x290d990] 1947 ms: Mark-sweep 579.8 (585.3) -> 578.2 (585.3) MB, 113.4 / 0.0 ms allocation failure GC in old space requested
[1902:0x290d990] 2058 ms: Mark-sweep 578.2 (585.3) -> 578.1 (585.3) MB, 110.9 / 0.0 ms allocation failure GC in old space requested
[1902:0x290d990] 2171 ms: Mark-sweep 578.1 (585.3) -> 578.1 (582.3) MB, 113.0 / 0.0 ms last resort
[1902:0x290d990] 2285 ms: Mark-sweep 578.1 (582.3) -> 578.1 (582.3) MB, 113.9 / 0.0 ms last resort
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x17eb3499ba79 <JS Object>
2: readTag [node_modules/exif-reader/index.js:~73] [pc=0x3c3385628136](this=0xf700c30a1c1 <JS Global Object>,buffer=0x224771009bf1 <an Uint8Array with map 0x3a70d19d3879>,offset=160,bigEndian=0x17eb349822c1 <true>)
3: readTags [node_modules/exif-reader/index.js:59] [pc=0x3c3385622341](this=0xf700c30a1c1 <JS Global Object>,b...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0x13647ec [node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
5: v8::internal::Factory::NewUninitializedFixedArray(int) [node]
6: 0xe90ca3 [node]
7: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [node]
8: 0x3c33854840bd
Aborted
While we're waiting Priyank Parashar has published his fork as exif-reader-paras20xx
with this fix in it.
@papandreou Tak!
Prevents all sorts of breakage when attempting to parse invalid or corrupt input.