Skip to content

Commit 00fddc3

Browse files
author
ripley
committed
as some sanity checking to smooth.spline, one seen in package checks
git-svn-id: https://svn.r-project.org/R/trunk@87397 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 5cb323c commit 00fddc3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/NEWS.Rd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,11 @@
448448
\item \code{rbind()} now works correctly when inputs include a raw
449449
vector and a logical, integer or double vector -- previously the
450450
inclusion of the latter was garbled.
451-
}
451+
452+
\item \code{smooth.spline()} checks validoity of its arguements
453+
\code{df.offset} and \code{penalty}: it could segfault if they
454+
were \code{NULL}.
455+
}
452456
}
453457
}
454458

src/library/stats/R/smspline.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ smooth.spline <-
166166
## icrit {../src/sslvrg.f}:
167167
## (0 = no crit, 1 = GCV , 2 = ord.CV , 3 = df-matching)
168168
icrit <- if(is.na(cv)) 0L else if(cv) 2L else 1L
169+
if(!is.numeric(df.offset) || df.offset < 0)
170+
stop("df.offset must be numeric and >= 0")
171+
if(!is.numeric(penalty) || penalty <= 0)
172+
stop("penalty must be numeric and > 0")
169173
dofoff <- df.offset
170174
if(!missing(df)) { # not when cv was NA
171175
if(df > 1 && df <= nx) {

0 commit comments

Comments
 (0)