[Dplr-commits] r858 - in pkg/dplR: . src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 6 08:17:41 CEST 2014


Author: mvkorpel
Date: 2014-05-06 08:17:41 +0200 (Tue, 06 May 2014)
New Revision: 858

Modified:
   pkg/dplR/DESCRIPTION
   pkg/dplR/src/rcompact.c
Log:
More (paranoid) robustness in C code of read.compact()

Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION	2014-05-05 21:01:03 UTC (rev 857)
+++ pkg/dplR/DESCRIPTION	2014-05-06 06:17:41 UTC (rev 858)
@@ -3,7 +3,7 @@
 Type: Package
 Title: Dendrochronology Program Library in R
 Version: 1.6.1
-Date: 2014-05-05
+Date: 2014-05-06
 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph",
         "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko",
         "Korpela", role = c("aut", "trl")), person("Franco", "Biondi",

Modified: pkg/dplR/src/rcompact.c
===================================================================
--- pkg/dplR/src/rcompact.c	2014-05-05 21:01:03 UTC (rev 857)
+++ pkg/dplR/src/rcompact.c	2014-05-06 06:17:41 UTC (rev 858)
@@ -153,6 +153,8 @@
 	 */
 	while(strchr(line, '~') == NULL){
 	    if(n_content > 0){ /* Skip empty lines */
+		if(n_comments == R_INT_MAX)
+		    error(_("Number of comments exceeds integer range"));
 		++n_comments;
 		tmp_comment = (char *) R_alloc(n_content+1, sizeof(char));
 		strncpy(tmp_comment, line, n_content);
@@ -170,6 +172,9 @@
 	if(early_eof == TRUE)
 	    break;
 
+	if(n == R_INT_MAX)
+	    error(_("Number of series exceeds integer range"));
+
 	/* A simple check to point out too long header
 	 * lines. Generally, if one line is too long, this function
 	 * will probably be unable to parse the next line. In that



More information about the Dplr-commits mailing list