safe_strto*() now also checks for empty input
authorW. Trevor King <wking@drexel.edu>
Thu, 13 Aug 2009 11:53:04 +0000 (07:53 -0400)
committerW. Trevor King <wking@drexel.edu>
Thu, 13 Aug 2009 11:53:04 +0000 (07:53 -0400)
.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/0346329e-7fa7-48d1-a2d9-a510d340edb2/body [new file with mode: 0644]
.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/0346329e-7fa7-48d1-a2d9-a510d340edb2/values [new file with mode: 0644]
.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/ae1157c8-666e-42ca-a9dd-c2d3f0087b18/body [new file with mode: 0644]
.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/ae1157c8-666e-42ca-a9dd-c2d3f0087b18/values [new file with mode: 0644]
.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/values [new file with mode: 0644]
src/sawsim.nw

diff --git a/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/0346329e-7fa7-48d1-a2d9-a510d340edb2/body b/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/0346329e-7fa7-48d1-a2d9-a510d340edb2/body
new file mode 100644 (file)
index 0000000..651d7e5
--- /dev/null
@@ -0,0 +1,4 @@
+$ bin/sawsim -s folded,hooke,1 -N1 -s unfolded,null -k 'folded,unfolded,bell,{,1}' -q folded
+#Force (N)      Initial state   Final state
+sawsim: build/k_model.c:174: bell_k: Assertion `p->knot > 0' failed.
+Aborted
diff --git a/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/0346329e-7fa7-48d1-a2d9-a510d340edb2/values b/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/0346329e-7fa7-48d1-a2d9-a510d340edb2/values
new file mode 100644 (file)
index 0000000..29ab604
--- /dev/null
@@ -0,0 +1,8 @@
+Author: W. Trevor King <wking@drexel.edu>
+
+
+Content-type: text/plain
+
+
+Date: Thu, 13 Aug 2009 11:47:58 +0000
+
diff --git a/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/ae1157c8-666e-42ca-a9dd-c2d3f0087b18/body b/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/ae1157c8-666e-42ca-a9dd-c2d3f0087b18/body
new file mode 100644 (file)
index 0000000..4b460bd
--- /dev/null
@@ -0,0 +1,6 @@
+Fixed.  Now you get:
+
+$ bin/sawsim -s folded,hooke,1 -N1 -s unfolded,null -k 'folded,unfolded,bell,{,1}' -q folded
+Error: unparsable empty string '' for string_create_bell_param_t
+sawsim: build/k_model.c:141: safe_strtod: Assertion `endp != s' failed.
+Aborted
diff --git a/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/ae1157c8-666e-42ca-a9dd-c2d3f0087b18/values b/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/comments/ae1157c8-666e-42ca-a9dd-c2d3f0087b18/values
new file mode 100644 (file)
index 0000000..62e7f02
--- /dev/null
@@ -0,0 +1,11 @@
+Author: W. Trevor King <wking@drexel.edu>
+
+
+Content-type: text/plain
+
+
+Date: Thu, 13 Aug 2009 11:52:12 +0000
+
+
+In-reply-to: 0346329e-7fa7-48d1-a2d9-a510d340edb2
+
diff --git a/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/values b/.be/bugs/bc85f1a9-d7af-4af9-bbe3-a1d5c25e9d61/values
new file mode 100644 (file)
index 0000000..19d869c
--- /dev/null
@@ -0,0 +1,17 @@
+creator: W. Trevor King <wking@drexel.edu>
+
+
+reporter: W. Trevor King <wking@drexel.edu>
+
+
+severity: minor
+
+
+status: open
+
+
+summary: safe_strto*() should check for blank strings
+
+
+time: Thu, 13 Aug 2009 11:47:22 +0000
+
index be36e715a1dfa0d57056f53556684e8b8301fbd3..96a786b964753a98438c92b28f7bbc1db1b30f67 100644 (file)
@@ -1126,6 +1126,10 @@ static int safe_strtoi(const char *s, const char *description) {
     fprintf(stderr, "Error: unparsable '%s' while parsing '%s' for %s\n",
             endp, s, description);
     assert(1==0);  //strlen(endp) == 0);
+  } if (endp == s) {
+    fprintf(stderr, "Error: unparsable empty string '%s' for %s\n",
+            s, description);
+    assert(endp != s);
   } else if (errno == ERANGE) {
     fprintf(stderr, "Error: '%s' out of range for %s\n", s, description);
     assert(errno != ERANGE);
@@ -1142,6 +1146,10 @@ static double safe_strtod(const char *s, const char *description) {
     fprintf(stderr, "Error: unparsable '%s' while parsing '%s' for %s\n",
             endp, s, description);
     assert(1==0);  //strlen(endp) == 0);
+  } if (endp == s) {
+    fprintf(stderr, "Error: unparsable empty string '%s' for %s\n",
+            s, description);
+    assert(endp != s);
   } else if (errno == ERANGE) {
     fprintf(stderr, "Error: '%s' out of range for %s\n", s, description);
     assert(errno != ERANGE);