Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2024-06-28 - [Stack Overflow DoS in Interactive Prompts]
**Vulnerability:** Recursive calls to `readline()` in `checkCorrect()`, `checkoldformBILOGprior()`, and `checknewformBILOGprior()` without bounding.
**Learning:** In R, unchecked recursive function calls, especially for user input loops, can cause a C stack overflow, leading to a Denial of Service (session crash).
**Prevention:** Use iterative `while` loops instead of recursion for repeatedly prompting users until valid input is received.
18 changes: 12 additions & 6 deletions R/aFIPC.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ autoFIPC <-

checkCorrect <- function() {
n <- readline(prompt = "Is it correct? (1: Yes 2: No) : ")
if (!grepl("^[0-9]+$", n)) {
return(checkCorrect())
while (!grepl("^[0-9]+$", n)) {
n <- readline(prompt = "Is it correct? (1: Yes 2: No) : ")
}

return(as.integer(n))
Expand All @@ -103,8 +103,11 @@ autoFIPC <-
readline(
prompt = "Do you want to use default BILOG-MG priors for oldform Data? (1: Yes 2: No) : "
)
if (!grepl("^[0-9]+$", n)) {
return(checkoldformBILOGprior())
while (!grepl("^[0-9]+$", n)) {
n <-
readline(
prompt = "Do you want to use default BILOG-MG priors for oldform Data? (1: Yes 2: No) : "
)
}

return(as.integer(n))
Expand Down Expand Up @@ -314,8 +317,11 @@ autoFIPC <-
readline(
prompt = "Do you want to use default BILOG-MG priors for newform Data? (1: Yes 2: No) : "
)
if (!grepl("^[0-9]+$", n)) {
return(checknewformBILOGprior())
while (!grepl("^[0-9]+$", n)) {
n <-
readline(
prompt = "Do you want to use default BILOG-MG priors for newform Data? (1: Yes 2: No) : "
)
}

return(as.integer(n))
Expand Down
Loading