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 - Issue with loading WEBP images with RWops
Summary: Issue with loading WEBP images with RWops
Status: RESOLVED FIXED
Alias: None
Product: SDL_image
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-15 12:06 UTC by Sylvain
Modified: 2017-10-22 09:05 UTC (History)
0 users

See Also:


Attachments
test case (1.31 KB, text/x-csrc)
2016-09-15 12:06 UTC, Sylvain
Details
a webp image (4.77 KB, image/webp)
2016-09-15 12:07 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
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. :)