Large (>1MB) colour profiles can crash with segmentation fault
See original GitHub issueHi,
We are experiencing node/express server crash when using sharp with specific images (4): segmentation fault
I’ve tried to go from using Buffer to Stream without any change. I’ve tried to isolate the problem without doing anything on the image like this:
const sharp = require('sharp');
sharp('./images/bug.jpg')
  .toFile('./images/out.jpg', (err, info) => {
    console.log({ err, info });
  });
here is one of the images: https://framapic.org/pRRvN4QD9sK4/akysnsC4rj15.jpg
Working locally with OSX Sierra, node 6.11.1, & same problem remotely with google gcp instances.
Thanks for helping
Issue Analytics
- State:
 - Created 6 years ago
 - Comments:12 (7 by maintainers)
 
Top Results From Across the Web
Identify what's causing segmentation faults (segfaults) - IU KB
A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core...
Read more >Why do I get a segfault in C from declaring a large array on the ...
You can fix this by either asking for extra stack when you create the thread, allocating on the heap, or changing the OS...
Read more >Composite Bug! | Forums | SideFX
So, if I ask for a 1Mb block, and no hole is big enough for this request, the allocation fails. The system can't...
Read more >Untitled
Support for bind 9.11.5 headers - Fix seg-fault parsing DWARF-1 information. ... feature (#1555397) - fix crash when write follows large read (#1463706) ......
Read more >Query: All Stories - Blender Development
Can confirm the issue, but 2.90.1 seems to behave like this either. ... Péter Friedrich (peterf) added a comment to T99015: Segmentation fault...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Brilliant, thank you, it looks like you’ve run into https://github.com/jcupitt/libvips/commit/7b64246af2cdf9c7b9fae0f29e5483bb6a7376d2 which was fixed in libvips 8.5.6.
This explains why the pre-compiled libvips binaries (8.5.5) fail and brew-installed libvips (8.5.9) works.
An OS-level backtrace is required here rather than a JS stacktrace.
As I mentioned above,
gdbis probably the best tool for this.You use it by running
gdb --args /usr/bin/node your-app.js, enterrunat the prompt, wait for the crash then enterbtat the prompt for the backtrace.