Skip to content

Commit

Permalink
add error check rather than brutal assert
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Courtin committed Nov 4, 2012
1 parent 6941b66 commit ce0b23e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/fe/fe_comparison_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,22 @@ static buffer *fe_binary_comparison_op(ows * o, buffer * typename, filter_encodi
if (buffer_cmp(name, "PropertyIsEqualTo") || buffer_cmp(name, "PropertyIsNotEqualTo")) {
/* remove brackets (if any) and quotation marks */
if (tmp->buf[0] == '(') {
/* FIXME assert in User input ! */
assert(tmp->use > 3);
if (tmp->use > 3) {
buffer_free(tmp);
buffer_free(name);
fe->error_code = FE_ERROR_FILTER;
return fe->sql;
}
buffer_pop(tmp, 2);
buffer_shift(tmp, 2);
} else {
/* FIXME assert in User input ! */
assert(tmp->use > 1);
if (tmp->use > 1) {
buffer_free(tmp);
buffer_free(name);
fe->error_code = FE_ERROR_FILTER;
return fe->sql;
}
buffer_pop(tmp, 1);
buffer_shift(tmp, 1);
}
Expand Down

0 comments on commit ce0b23e

Please sign in to comment.