Skip to content

Commit

Permalink
Workaround 5.0 asan findings
Browse files Browse the repository at this point in the history
Make 16 the arrays explicitly 16 bytes large so that reads exceeding
them aren't flag as out of bounds reads
  • Loading branch information
deweerdt committed Aug 16, 2018
1 parent 2a16b23 commit 8040379
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions picohttpparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
#define ADVANCE_TOKEN(tok, toklen) \
do { \
const char *tok_start = buf; \
static const char ALIGNED(16) ranges2[] = "\000\040\177\177"; \
static const char ALIGNED(16) ranges2[16] = "\000\040\177\177"; \
int found2; \
buf = findchar_fast(buf, buf_end, ranges2, sizeof(ranges2) - 1, &found2); \
buf = findchar_fast(buf, buf_end, ranges2, 4, &found2); \
if (!found2) { \
CHECK_EOF(); \
} \
Expand Down Expand Up @@ -138,15 +138,15 @@ static const char *get_token_to_eol(const char *buf, const char *buf_end, const
const char *token_start = buf;

#ifdef __SSE4_2__
static const char ranges1[] = "\0\010"
static const char ranges1[16] = "\0\010"
/* allow HT */
"\012\037"
/* allow SP and up to but not including DEL */
"\177\177"
/* allow chars w. MSB set */
;
int found;
buf = findchar_fast(buf, buf_end, ranges1, sizeof(ranges1) - 1, &found);
buf = findchar_fast(buf, buf_end, ranges1, 6, &found);
if (found)
goto FOUND_CTL;
#else
Expand Down

0 comments on commit 8040379

Please sign in to comment.