commit 23147205c7b477873aaf34e17744361e2f0ee61c
parent 5647bb6765af37fe450a5b0b0bbe0449bc78d59b
Author: Remy Noulin <loader2x@gmail.com>
Date: Wed, 1 Jun 2022 21:16:04 +0200
json parser: detect string escape errors earlier
release/json/libsheepyCSmallArray.h | 2 +-
src/json/laxjson.c | 3 ++-
src/json/libsheepyCSmallArray.h | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
Diffstat:
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/release/json/libsheepyCSmallArray.h b/release/json/libsheepyCSmallArray.h
@@ -464,7 +464,7 @@ typedef smallArrayt* (*sliceSmallArrayFt) (smallArrayt *self, int64
* \param
* end index, must be in the list
* \return
- * new sliced list (you must free (terimate) the pointer)
+ * new sliced list (you must free (terminate) the pointer)
* empty list when start=end
* unchanged when list is empty
* unchanged when list is NULL or when start and end are not set correctly
diff --git a/src/json/laxjson.c b/src/json/laxjson.c
@@ -368,7 +368,8 @@ enum LaxJsonError lax_json_feed(struct LaxJsonContext *context, int size, const
context->unicode_point = 0;
break;
default:;
- // do nothing
+ // "\" should be escaped
+ return LaxJsonErrorAborted;
}
break;
case LaxJsonStateUnicodeEscape:
diff --git a/src/json/libsheepyCSmallArray.h b/src/json/libsheepyCSmallArray.h
@@ -464,7 +464,7 @@ typedef smallArrayt* (*sliceSmallArrayFt) (smallArrayt *self, int64
* \param
* end index, must be in the list
* \return
- * new sliced list (you must free (terimate) the pointer)
+ * new sliced list (you must free (terminate) the pointer)
* empty list when start=end
* unchanged when list is empty
* unchanged when list is NULL or when start and end are not set correctly