Skip to content

Commit

Permalink
warn and ignore too-small image resolutions; from Max Chernoff
Browse files Browse the repository at this point in the history
git-svn-id: svn://tug.org/texlive/trunk/Build/source@73494 c570f23f-e606-0410-a88d-b1316a301751
  • Loading branch information
kberry committed Jan 17, 2025
1 parent 8be9c39 commit a4c483b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions texk/web2c/pdftexdir/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2025-01-17 Max Chernoff <[email protected]>

* pdftex.web (Glob..., Set init...): new global
resolution_ratio==226.
(scale_image): use it to report a warning for too-small resolutions
(e.g., 1px x 1px). https://tex.stackexchange.com/questions/734919

2024-08-04 Thanh Han The <[email protected]>

* pdftoepdf.cc (write_epdf): reversed sep and pdfkeyprefix.
Expand Down
2 changes: 2 additions & 0 deletions texk/web2c/pdftexdir/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
entries use an _ instead of ., as in PTEX_Fullbanner.
- bugfixes:
- increase tolerance for detecting interword spaces in overfull lines.
- ignore tiny resolutions like 1x1 embedded in images instead of
exceeding \maxdimen.

pdfTeX 3.141592653-2.6-1.40.26 (TeX Live 2024)
- bugfixes:
Expand Down
9 changes: 9 additions & 0 deletions texk/web2c/pdftexdir/pdftex.web
Original file line number Diff line number Diff line change
Expand Up @@ -15787,6 +15787,7 @@ accuracy.
@!ten_pow: array[0..9] of integer; {$10^0..10^9$}
@!scaled_out: integer; {amount of |scaled| that was taken out in
|divide_scaled|}
@!resolution_ratio: integer; {(1in in sp)/|\maxdimen|}
@!init_pdf_output: boolean;
@!adv_char_width_s: integer; {to save result of calculation done in |adv_char_width| }
@!adv_char_width_s_out: scaled;
Expand All @@ -15795,6 +15796,7 @@ accuracy.
one_bp := 65782; {65781.76}
one_hundred_bp := 6578176;
one_hundred_inch := 473628672;
resolution_ratio := 226;
ten_pow[0] := 1;
for i := 1 to 9 do
ten_pow[i] := 10*ten_pow[i - 1];
Expand Down Expand Up @@ -34429,6 +34431,13 @@ begin
end;
if (x <= 0) or (y <= 0) or (xr < 0) or (yr < 0) then
pdf_error("ext1", "invalid image dimensions");
if (x / resolution_ratio >= xr) or (y / resolution_ratio >= yr) then begin
{It's better to warn and ignore too-small resolutions given in
the image file, usually 1dpi x 1dpi, to avoid arithmetic overflow.}
xr := 0;
yr := 0;
pdf_warning("ext1", "too small image resolution ignored", true, true);
end;
if is_pdf_image(image) then begin
w := x;
h := y;
Expand Down

0 comments on commit a4c483b

Please sign in to comment.