Skip to content

Added writing XMP bytes to JPEG #8286

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

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added comments to explain overhead_len
  • Loading branch information
radarhere committed Aug 5, 2024
commit c056406f21e2a5aa87a8e4560fc33e079bed59e8
4 changes: 2 additions & 2 deletions src/PIL/JpegImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def validate_qtables(
MAX_BYTES_IN_MARKER = 65533
xmp = info.get("xmp")
if xmp:
overhead_len = 29
overhead_len = 29 # b"http://ns.adobe.com/xap/1.0/\x00"
max_data_bytes_in_marker = MAX_BYTES_IN_MARKER - overhead_len
if len(xmp) > max_data_bytes_in_marker:
msg = "XMP data is too long"
Expand All @@ -759,7 +759,7 @@ def validate_qtables(

icc_profile = info.get("icc_profile")
if icc_profile:
overhead_len = 14
overhead_len = 14 # b"ICC_PROFILE\0" + o8(i) + o8(len(markers))
max_data_bytes_in_marker = MAX_BYTES_IN_MARKER - overhead_len
markers = []
while icc_profile:
Expand Down
Loading