aboutsummaryrefslogtreecommitdiff
path: root/src/mpack
diff options
context:
space:
mode:
Diffstat (limited to 'src/mpack')
-rw-r--r--src/mpack/lmpack.c2
-rw-r--r--src/mpack/mpack_core.c10
-rw-r--r--src/mpack/mpack_core.h2
3 files changed, 8 insertions, 6 deletions
diff --git a/src/mpack/lmpack.c b/src/mpack/lmpack.c
index 126f2f3824..53d7092a0c 100644
--- a/src/mpack/lmpack.c
+++ b/src/mpack/lmpack.c
@@ -246,7 +246,7 @@ static mpack_uint32_t lmpack_objlen(lua_State *L, int *is_array)
}
end:
- if ((size_t)-1 > (mpack_uint32_t)-1 && len > (mpack_uint32_t)-1)
+ if ((size_t)-1 > (mpack_uint32_t)-1 && len > (mpack_uint32_t)-1) // -V560
/* msgpack spec doesn't allow lengths > 32 bits */
len = (mpack_uint32_t)-1;
assert(top == lua_gettop(L));
diff --git a/src/mpack/mpack_core.c b/src/mpack/mpack_core.c
index f8ca63b7a3..4ee67a032a 100644
--- a/src/mpack/mpack_core.c
+++ b/src/mpack/mpack_core.c
@@ -12,8 +12,6 @@
# define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
#endif
-static int mpack_rtoken(const char **buf, size_t *buflen,
- mpack_token_t *tok);
static int mpack_rpending(const char **b, size_t *nl, mpack_tokbuf_t *tb);
static int mpack_rvalue(mpack_token_type_t t, mpack_uint32_t l,
const char **b, size_t *bl, mpack_token_t *tok);
@@ -52,7 +50,10 @@ MPACK_API int mpack_read(mpack_tokbuf_t *tokbuf, const char **buf,
int status;
size_t initial_ppos, ptrlen, advanced;
const char *ptr, *ptr_save;
- assert(*buf && *buflen);
+ assert(*buf);
+ if (*buflen == 0) {
+ return MPACK_EOF;
+ }
if (tokbuf->passthrough) {
/* pass data from str/bin/ext directly as a MPACK_TOKEN_CHUNK, adjusting
@@ -170,8 +171,7 @@ MPACK_API int mpack_write(mpack_tokbuf_t *tokbuf, char **buf, size_t *buflen,
return MPACK_OK;
}
-static int mpack_rtoken(const char **buf, size_t *buflen,
- mpack_token_t *tok)
+int mpack_rtoken(const char **buf, size_t *buflen, mpack_token_t *tok)
{
unsigned char t = ADVANCE(buf, buflen);
if (t < 0x80) {
diff --git a/src/mpack/mpack_core.h b/src/mpack/mpack_core.h
index 9edd13c41e..1d601bc82d 100644
--- a/src/mpack/mpack_core.h
+++ b/src/mpack/mpack_core.h
@@ -83,5 +83,7 @@ MPACK_API int mpack_read(mpack_tokbuf_t *tb, const char **b, size_t *bl,
mpack_token_t *tok) FUNUSED FNONULL;
MPACK_API int mpack_write(mpack_tokbuf_t *tb, char **b, size_t *bl,
const mpack_token_t *tok) FUNUSED FNONULL;
+int mpack_rtoken(const char **buf, size_t *buflen,
+ mpack_token_t *tok);
#endif /* MPACK_CORE_H */