We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3425

Summary: Issue with loading WEBP images with RWops
Product: SDL_image Reporter: Sylvain <sylvain.becker>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: x86_64   
OS: Linux   
Attachments: test case
a webp image

Description Sylvain 2016-09-15 12:06:39 UTC
Created attachment 2562 [details]
test case

Some user reported an issue when loading a WEBP image from RWOPS stream.
Here's a test case in attachment.


Some fix in "IMG_webp.c" file:

remove:

209     // seek to start of file
210     SDL_RWseek(src, 0, RW_SEEK_SET );
211 



replace:

162             if ( datasize ) {
163                 *datasize = (int)SDL_RWseek(src, 0, SEEK_END);
164             }

by:

162             if ( datasize ) {
163                 *datasize = (int)SDL_RWseek(src, 0, SEEK_END) - start;
164             }


Fix is partial because it won't work if multiple files are concatenated in the stream (One needs to modify "webp_getinfo" to get correctly the size).
Comment 1 Sylvain 2016-09-15 12:07:05 UTC
Created attachment 2563 [details]
a webp image
Comment 2 Sam Lantinga 2017-10-22 09:05:55 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL_image/rev/4491ac456363

That was a really good test case. :)