[NTG-pdftex] [ pdftex-Bugs-444 ] buffer overflow with \pdfmatch

noreply at sarovar.org noreply at sarovar.org
Tue Jan 3 20:03:51 CET 2006


Bugs item #444, was opened at 2005-10-29 17:24
You can respond by visiting: 
http://sarovar.org/tracker/?func=detail&atid=493&aid=444&group_id=106

Category: None
Group: v1.30.0
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Robert (schlcht)
Assigned to: Martin Schröder (oneiros)
Summary: buffer overflow with \pdfmatch

Initial Comment:
% The new \pdfmatch primitive will run into a buffer
overflow with strings
% longer than 1023 characters:
%
% (I am using 1.30.3 with Thanh's patches from
pdftex.sarovar.org/src,
% compiled under cygwin.)


\def\x{1,2,3,4,5,6,7,8,9,0,}
\def\testlist{%
  ,\x\x\x\x\x \x\x\x\x\x \x\x\x\x\x \x\x\x\x\x
   \x\x\x\x\x \x\x\x\x\x \x\x\x\x\x \x\x\x\x\x
   \x\x\x\x\x \x\x\x\x\x \x00,}% 1024

\ifcase\pdfmatch{,1,}{\testlist}\relax \fi

% Also, if the pattern is too long:
%\ifcase\pdfmatch{\testlist}{1}\relax \fi

\bye,
Robert.

PS: Is there a simple way to escape all regex special
characters in a string?



----------------------------------------------------------------------

>Comment By: Robert (schlcht)
Date: 2006-01-03 19:03

Message:
Logged In: YES 
user_id=2217

Hm, not really... The test case above still fails with both
1.30.5 and 1.40.0-alpha.

Regards,
Robert.

----------------------------------------------------------------------

Comment By: Martin Schröder (oneiros)
Date: 2005-12-04 14:12

Message:
Logged In: YES 
user_id=421

This has been fixed in 1.30.5

----------------------------------------------------------------------

Comment By: Hartmut Henkel (hhenkel)
Date: 2005-10-29 19:08

Message:
Logged In: YES 
user_id=929

see patch to utils.c. This makes makecstring() memory grow
on demand. Also increase MAX_CSTRING_LEN in ptexmac.h to e.
g. 10000000.

----------------------------------------------------------------------

You can respond by visiting: 
http://sarovar.org/tracker/?func=detail&atid=493&aid=444&group_id=106


More information about the ntg-pdftex mailing list