[Rd] pixmap: infinite recursion with nonascii pnm-files (PR#1199)

thomas.baumann@ch.tum.de thomas.baumann@ch.tum.de
Fri, 7 Dec 2001 11:06:28 +0100 (MET)


Problem:

read.pnm from pixmap_0.2-1.tar.gz stops with an infinite recursion if a
"#" occurs within the raw (binary) data of a pnm-file.


The reason for this behaviour seems to be the handling of comments in
read.pnmhead. The recursive call of strip.comments requires a newline to
complete sucessfully. A work-around would be

diff -r pixmap/R/pnm.R pixmap.orig/R/pnm.R
112c112
<       com1 <- as.integer(regexpr("#.*\n", inpstr))
---
>       com1 <- as.integer(regexpr("#", inpstr))

i.e. to check if the comment sign is actually followed by a newline.

However, if this sequence (#.*\n) would occur within the data and within
the first 350 bytes of the pnm-file the data would be stripped as well.

Furthermore, comments within the data of ascii files after byte 350 are
not handled correctly and lead to an error. Although this seems to be a
rare case, it might occur and it is allowed by the pnm-file
specification.

Thomas

--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = 
 major = 1
 minor = 3.1
 year = 2001
 month = 08
 day = 31
 language = R

Search Path:
 .GlobalEnv, package:pixmap, package:ctest, Autoloads, package:base



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._