[Poppler-bugs] [Bug 103873] pdfunite introduces syntax error / illegal characters (as per pdfinfo)

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Dec 5 21:41:12 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=103873

--- Comment #8 from Tom Yan <tom.ty89 at gmail.com> ---
(In reply to Fredrik Fornwall from comment #6)
> From https://github.com/termux/termux-packages/issues/1900:
> 
> "prior to Android P (i.e. AOSP master), Android's printf didn't accept
> invalid UTF8 sequences in the format string, and so can't be used to print
> arbitrary bytes like this. you'd need to use %c%c%c%c -- as your other
> example does -- or (hilariously) %s (because only the format string is
> checked). this is from BSD code, so it's not just Android that has/had this
> limitation, so you may be able to get upstream to switch to the same
> %c%c%c%c workaround as your other example."
> 
> Would the above patch work for you?

Yup I am on Android N and can confirm that the \x is the problem:

$ cat test.c
#include <stdio.h>
int main() {
  printf("%%\xE2\xE3\xCF\xD3\n");
  printf("%%%s\n", "\xE2\xE3\xCF\xD3");
  printf("%%%c%c%c%c\n", 0xe2, 0xe3, 0xcf, 0xd3);
}
$ clang test.c
$ ./a.out
%%����
%����
$ ./arch/startarch
[21:37 home ]$ clang test.c
[21:38 home ]$ ./a.out
%����
%����
%����

And pdfinfo no longer complains about any file produced by pdfunite in poppler
0.61.1-2 on Termux (which has the patch applied).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20171205/ee120e27/attachment.html>


More information about the Poppler-bugs mailing list