Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rgb.rowBytes in overflow check #18

Merged
merged 18 commits into from
Feb 3, 2025

Conversation

radarhere
Copy link

Suggestions for python-pillow#5201

-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)

So let's build libjpeg first.

  • TestFileAvif has @skip_unless_feature("avif"), which means that methods within that class don't also need the decorator.
  • I'm confused by the overflow check.
row_bytes = rgb.width * avifRGBImagePixelSize(&rgb);

if (rgb.height > PY_SSIZE_T_MAX / row_bytes) {
  ...
}
...
size = rgb.rowBytes * rgb.height;

Shouldn't both the check and the multiplication use the same values? I've suggested that change here.

@fdintino
Copy link
Owner

fdintino commented Feb 3, 2025

libjpeg isn't actually used. libyuv has find_package(JPEG) in its CMakeLists because there are some jpeg tests and utilities, but those don't concern us. Still, there isn't any harm in ordering the build differently.

I agree regarding rgb.rowBytes. I can't say why I was calculating rowBytes here and not just using the avifRGBImage value.

@fdintino fdintino merged commit 19ba2dd into fdintino:libavif-plugin Feb 3, 2025
55 of 64 checks passed
@radarhere radarhere deleted the libavif-plugin branch February 3, 2025 02:35
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.

2 participants