Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

IMCC: Be more careful with pointers parsing FIAs

- Don't let the end be before the start
- Incrementing past NULL is generally considered poor on a C string.
  • Loading branch information...
commit b58a50c2b147c5ea52a6fdddd3ceeb6716ecf92c 1 parent e7d7c16
@Benabik Benabik authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 compilers/imcc/pbc.c
View
5 compilers/imcc/pbc.c
@@ -1923,7 +1923,7 @@ init_fixedintegerarray_from_string(ARGMOD(imc_info_t * imcc), ARGIN(PMC *p),
while (*start == ' ' || *start == '\t' || *start == '(') { ++start; }
/* Skip trailing whitespace and ) */
- while (end >= src && (*end == ' ' || *end == '\t' || *end == ')')) {
+ while (end >= start && (*end == ' ' || *end == '\t' || *end == ')')) {
--end;
}
++end;
@@ -1989,8 +1989,9 @@ init_fixedintegerarray_from_string(ARGMOD(imc_info_t * imcc), ARGIN(PMC *p),
case ' ':
case '\t':
case ')':
- case '\0':
++chr;
+ /* Fallthrough */
+ case '\0':
break;
case ',':
/* Hold onto the , for the test at the start of the loop */
Please sign in to comment.
Something went wrong with that request. Please try again.