Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

kleisauke
Copy link
Member

More testing is needed, so opened as a draft.

Resolves: #2757.

Context regarding the change to thumbnail_image:
https://app.gitter.im/#/room/#libvips_devchat:gitter.im/$x6M0KbuEpkdFjKFVmdRDf0V6m6NvPMD9Q4kwJevRrT8

@kleisauke kleisauke force-pushed the revise-resample-seq branch from f570895 to 3037cb3 Compare August 22, 2025 14:43
@kleisauke
Copy link
Member Author

The fuzzer bug reported https://github.com/libvips/libvips/actions/runs/17152025286/job/48660246466 is quite interesting. It seems that the removal of the seq hint in reducev means we can no longer guarantee buffer alignment, which was previously ensured here:

/* Need to pad buffer size to be aligned-up to
* 64 bytes for the vips_reduce{h,v} highway path.
*/
#ifdef HAVE_HWY
if (im->BandFmt == VIPS_FORMAT_UCHAR) {
new_bsize += /*HWY_ALIGNMENT*/ 64 - 1;
align = /*HWY_ALIGNMENT*/ 64;
}
else
#endif /*HAVE_HWY*/
align = 16;

At first, I thought this would be an easy fix (see commit baf91e4), but it turned out to confuse FFTW's SIMD alignment checks, which I worked around in commit f570895.

Unfortunately, crashes still occur in certain cases, for example:

$ vips black crash1.pgm 1 70
$ ./build/fuzz/thumbnail_fuzzer -rss_limit_mb=2560 -timeout=25 -runs=100 ./crash1.pgm < /dev/null

i.e. we can't guarantee that image->data is properly aligned, since it can also be initialized via vips_image_new_from_memory().

I dropped the previous mentioned commits in favor of commit 3037cb3, but still need to verify whether that is safe on all targets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant