I am having a issue where when I try to create a new Sharp instance from a webp image I have just cropped, it throws
[Error: Input buffer has corrupt header: glib: XML parse error: Error domain 1 code 4 on line 1 column 1 of data: Start tag expected, '<' not found
Are you using the latest version? Is the version currently in use as reported by
npm ls sharpthe same as the latest version as reported bynpm view sharp dist-tags.latest?
Yes, Using 0.25.4
What are the steps to reproduce?
I have made an example repo, with failure being reported inside of github actions
https://github.com/blacha/libvips-webp-bug
https://github.com/blacha/libvips-webp-bug/runs/1005553347
What is the expected behaviour?
I would expect sharp to be able to read in a image that it has recently created.
If I force this image buffer into png using .png().toBuffer() the issue goes away.
Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?
Yes see https://github.com/blacha/libvips-webp-bug
Are you able to provide a sample image that helps explain the problem?
https://github.com/blacha/libvips-webp-bug/blob/master/bug_tile.webp
What is the output of running
npx envinfo --binaries --system?
from my local machine
npx: installed 1 in 0.841s
System:
OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Memory: 994.94 MB / 31.31 GB
Container: Yes
Shell: 3.1.0 - /usr/bin/fish
Binaries:
Node: 14.8.0 - ~/.config/n/bin/node
Yarn: 1.22.4 - ~/.config/n/bin/yarn
npm: 6.14.7 - ~/.config/n/bin/npm
This is a great bug. The compressed WebP data happens to contain the string <svg, which is tripping up on libvips' SVG detection.
I've opened a PR to fix this at https://github.com/libvips/libvips/pull/1787
That is really funny!
Awesome work for for tracking that down soo quickly!
@lovell Looks like this was merged/release as libvips 8.10.1, will this be included in the next 0.26.1 release?
sharp v0.27.0 now available with a prebuilt libvips v8.10.5 - thanks for reporting this.
Most helpful comment
This is a great bug. The compressed WebP data happens to contain the string
<svg, which is tripping up on libvips' SVG detection.I've opened a PR to fix this at https://github.com/libvips/libvips/pull/1787