summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-07 19:57:53 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-07 21:34:12 -0700
commit08c8b7a6ee4232c5a6614b8fc4aac2b337623de0 (patch)
tree843bf84f587586dd03dfde30c0d8074a43c5c3f0
parentf872b47cb606d448766c1fa750709fd06a8a6904 (diff)
Improved error handling for corrupt intensity profiles
loadData.c:661:15: warning: Access to field 'value' results in a dereference of a null pointer (loaded from variable 'pIRec') pIRec->value = tmp; ~~~~~ ^ loadData.c:682:19: warning: The right operand of '>' is a garbage value if (++count > size) { ^ ~~~~ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--loadData.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/loadData.c b/loadData.c
index 340fd96..aac86bd 100644
--- a/loadData.c
+++ b/loadData.c
@@ -634,6 +634,11 @@ ProcessIProfile(FILE *stream, XDCCC_Correction *pCorrection)
state = 0;
break;
case DATA :
+ if(pIRec == NULL) {
+ fprintf(stderr, "Line %d: Invalid Intensity Profile -- Premature %s\n",
+ linenum, keyword);
+ return (0);
+ }
do {
/********************************************************
* Note: tableType should only be 0 or 1 at this point.