Skip to content
Snippets Groups Projects
Commit 89d7f673 authored by Dmitry Simonenko's avatar Dmitry Simonenko
Browse files

tp: validate tuple and field size's.

parent ce010447
No related branches found
No related tags found
No related merge requests found
...@@ -1065,6 +1065,8 @@ tp_next(struct tp *p) { ...@@ -1065,6 +1065,8 @@ tp_next(struct tp *p) {
p->t = tp_tupleend(p) + 4; p->t = tp_tupleend(p) + 4;
fetch: fetch:
p->tsz = *(uint32_t*)(p->t - 4); p->tsz = *(uint32_t*)(p->t - 4);
if (tp_unlikely((p->t + p->tsz) > p->e))
return -1;
p->f = NULL; p->f = NULL;
return 1; return 1;
} }
...@@ -1087,6 +1089,8 @@ fetch:; ...@@ -1087,6 +1089,8 @@ fetch:;
register int rc = tp_leb128load(p, &p->fsz); register int rc = tp_leb128load(p, &p->fsz);
if (tp_unlikely(rc == -1)) if (tp_unlikely(rc == -1))
return -1; return -1;
if (tp_unlikely((p->f + p->fsz) > p->e))
return -1;
return 1; return 1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment