Update Decode() for ImageDecoder API 3.1.0 - #91
Merged
Conversation
xbmc/xbmc#29068 added size_t pixelBufferSize to the C++ Decode() signature. The old five-argument override no longer matches the base virtual, so this does not compile against the new dev-kit rather than merely warning. Signature only; the argument is used in the next commit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Use the pixelBufferSize argument added in the previous commit: work out what the copy loop actually reaches and return false rather than write past the end. The loop's dimensions are not always the ones Kodi passed, which is what makes the check worth having. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| src/HeifPicture.cpp | Updates the Decode implementation for API 3.1.0 and adds a bounds check matching the existing pixel-writing loop. |
| src/HeifPicture.h | Adds the API 3.1.0 pixel-buffer-size parameter to the Decode override declaration. |
Reviews (1): Last reviewed commit: "Refuse a decode that would not fit the o..." | Re-trigger Greptile
The copy loop writes B,G,R and fills the fourth byte only for A8R8G8B8, so that is the only format actually produced. Every other value fell through to that same loop and returned true with output that does not match the request. ADDON_IMG_FMT_A8 was the worst of them: one byte per pixel is asked for and three are written. The previous commit's bounds check now refuses that, but it should not be reached at all. Latent today only because CTexture::LoadIImage() asks for A8R8G8B8. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 30, 2026
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Readies the add-on for ImageDecoder API 3.1.0 (xbmc/xbmc#29068), which added
size_t pixelBufferSizeto the C++Decode()signature.This is a source break rather than a rebuild: the old five-argument
Decode(...) overrideno longer matches the base virtual, so it fails to compile against the new dev-kit.Two commits, separable. The first is the signature alone and unblocks the build. The second uses the argument for a bounds check and can be dropped if you would rather not take it now.
The check is worth having here because the loop writes 3 bytes per pixel, or 4 for
ADDON_IMG_FMT_A8R8G8B8, so its reach depends on the requested format as well as the geometry.Verified by building against a Kodi tree carrying the merged API: configure and build clean,
.soproduced. The generatedaddon.xmlpicks upminversion="3.1.0" version="3.1.0"from the dev-kit on its own, so nothing needs hardcoding inaddon.xml.in.Written by my AI co-author (Claude Code); posted from my account.