summaryrefslogtreecommitdiff
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
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>.
-rw-r--r--ChangeLog10
-rw-r--r--tmac/pdfpic.tmac5
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 76d549865..e142662ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2022-01-21 G. Branden Robinson <g.branden.robinson@gmail.com>
+ [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>.
+
+2022-01-21 G. Branden Robinson <g.branden.robinson@gmail.com>
+
[pdfpic]: Regression-test Savannah #58206.
* tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh: Do
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\