summaryrefslogtreecommitdiff
path: root/tmac/pdfpic.tmac
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2022-01-21 20:38:19 +1100
committerG. Branden Robinson <g.branden.robinson@gmail.com>2022-01-21 20:38:19 +1100
commit1483e1168224e9d37ff0986ccf5e3346af7e9281 (patch)
tree849957b8f984de46cb088c6333ddfdfb3a972ba6 /tmac/pdfpic.tmac
parent3f094e31225d0a22b250afedf4ee13f3902bd691 (diff)
downloadgroff-git-1483e1168224e9d37ff0986ccf5e3346af7e9281.tar.gz
[pdfpic]: Fix Savannah #58206.
* tmac/pdfpic.tmac (PDFPIC): Scrub null bytes out of pdfinfo(1) output. Thanks to an anonymous contributor for the patch (the commentary about it is mine, if someone wants an argument). Fixes <https://savannah.gnu.org/bugs/?58206>.
Diffstat (limited to 'tmac/pdfpic.tmac')
-rw-r--r--tmac/pdfpic.tmac5
1 files changed, 4 insertions, 1 deletions
diff --git a/tmac/pdfpic.tmac b/tmac/pdfpic.tmac
index c2159674b..46228fb69 100644
--- a/tmac/pdfpic.tmac
+++ b/tmac/pdfpic.tmac
@@ -118,9 +118,12 @@
. return
. \}
.
-. \" get image dimensions
+. \" Get image dimensions. The `tr` command to strip null bytes is
+. \" distasteful, but its necessity is imposed on us. See
+. \" <https://gitlab.freedesktop.org/poppler/poppler/-/issues/776>.
. ec @
. sy pdfinfo @$1 | \
+tr -d '\000' | \
grep "Page *size" | \
sed -e 's/Page *size: *\\([[:digit:].]*\\) *x *\\([[:digit:].]*\\).*$/\
.nr pdfpic*width (p;\\1)\\n\