[pdftex] Bug fix for function add_ch of pdfcrypt-full.c
Heiko Oberdiek
oberdiek at ruf.uni-freiburg.de
Wed Jan 9 22:30:14 CET 2002
Hello,
D.P. Story has written a bugreport regarding pdfcrypt.sty to me,
but I could generate a minimal test file that shows that the
error is in the pdfcrypt part of pdfTeX:
\pdfcrypt noprint\relax
\font\rm=ptmr at 20pt
\font\tt=pcrr at 20pt
\nopagenumbers
\parskip=10pt
\begingroup
\catcode`\@=0
\catcode`\\=12
@gdef @bmA {[\r] [\\r] [\\\r] [\\\\r]}
@gdef @bmB {[\] [\\] [\\\] [\\\\]}
@gdef @bmC {[] [\] [\] [\\]}
@endgroup
\pdfcatalog{/PageMode/UseOutlines}%
\pdfdest name{start}XYZ\relax
\rm Bookmark 1: \tt \bmA\par
\rm Bookmark 2: \tt \bmB\par
\rm Expected 2: \tt \bmC\par
\pdfoutline goto name{start}{\bmA}\relax
\pdfoutline goto name{start}{\bmB}\relax
\bye
The backslash is treated differently in the second bookmark,
if pdfcrypt (first line) is enabled or not. A backslash
should not be ignored, if no special character is followed
(b,t,n,r,\,(,),0-8).
So I suggest the folowing addition to the source code
(of version 1.00a-pretest-20010806):
*** pdfcrypt-full.c.saved Wed Jan 9 21:59:50 2002
--- pdfcrypt-full.c Wed Jan 9 22:22:07 2002
***************
*** 256,264 ****
case 102: ch=12; (*x)++; break; /* \f */
case 114: ch=13; (*x)++; break; /* \r */
default: /* octal */
! if ( (s[*x] > 47) && (s[*x] < 56) ) ch = s[(*x)++] - 48;
! if ( (s[*x] > 47) && (s[*x] < 56) ) ch = s[(*x)++] - 48 + ch*8;
! if ( (s[*x] > 47) && (s[*x] < 56) ) ch = s[(*x)++] - 48 + ch*8;
}
}
if (encrypt) ch = pdfcrypt_byte(ch);
--- 256,270 ----
case 102: ch=12; (*x)++; break; /* \f */
case 114: ch=13; (*x)++; break; /* \r */
default: /* octal */
! if ( (s[*x] > 47) && (s[*x] < 56) ) {
! ch = s[(*x)++] - 48;
! if ( (s[*x] > 47) && (s[*x] < 56) ) ch = s[(*x)++] - 48 + ch*8;
! if ( (s[*x] > 47) && (s[*x] < 56) ) ch = s[(*x)++] - 48 + ch*8;
! }
! else {
! /* ignore backslash, if the next character is not special */
! ch = s[(*x)++];
! }
}
}
if (encrypt) ch = pdfcrypt_byte(ch);
Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
More information about the pdftex
mailing list