commit dc5dc69ca66dae12b8a0c7ed670a41264f49d739
parent 25b09215378f6f96337df76a01fdbda7aa9907ae
Author: Remy Noulin <loader2x@gmail.com>
Date: Fri, 1 Jan 2021 20:29:15 +0100
add cppcheck script and fix an issue btrace
print a meaningful message when readelf returns an unexpected line
release/libsheepy.c | 5 +++++
src/cppcheck.sh | 19 +++++++++++++++++++
src/libsheepy.c | 5 +++++
3 files changed, 29 insertions(+)
Diffstat:
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/release/libsheepy.c b/release/libsheepy.c
@@ -53319,6 +53319,11 @@ char **btrace(void) {
status = 1;
}
}
+ if (!offset) {
+ shEPrintfS("Could not parse backtrace string, got: '%s', expected a string in the form './exe(main+0x69) [0x556c7d39509b]'");
+ free(bts);
+ return(NULL);
+ }
size_t funcNameLen = (offset-1) - funcName;
// search function in all funtions from the elf file
diff --git a/src/cppcheck.sh b/src/cppcheck.sh
@@ -0,0 +1,19 @@
+cppcheck --std=c99 --force ../release/libsheepy.c 2> cppcheck.log
+cppcheck --std=c99 --force libsheepySmall.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyObject.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallJson.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCUndefined.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallDict.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallArray.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallBytes.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallBool.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallContainer.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallDouble.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallInt.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/libsheepyCSmallString.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/laxjson.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/ymlParser.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/ymlApi.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/ymlScanner.c 2>> cppcheck.log
+cppcheck --std=c99 --force json/ymlReader.c 2>> cppcheck.log
+cppcheck --std=c99 --force tpool.c 2>> cppcheck.log
diff --git a/src/libsheepy.c b/src/libsheepy.c
@@ -53375,6 +53375,11 @@ char **btrace(void) {
status = 1;
}
}
+ if (!offset) {
+ shEPrintfS("Could not parse backtrace string, got: '%s', expected a string in the form './exe(main+0x69) [0x556c7d39509b]'");
+ free(bts);
+ return(NULL);
+ }
size_t funcNameLen = (offset-1) - funcName;
// search function in all funtions from the elf file