diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2004-08-08 19:24:24 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2004-08-08 19:24:24 +0000 |
commit | 3eaff1b1af94c3253f46fd4dee5afd79982c557c (patch) | |
tree | c7c38fc175c21fadc1510b9689d2066cc528bbe0 | |
parent | fe20a59c2f21da8587f57d524d1e231bcbb40838 (diff) |
Make sure that format variable is not a variable sized array correctly
when doing bounds checking (bug revealed by mmap malloc).
Noticed by krause@, tested otto@
-rw-r--r-- | gnu/egcs/gcc/c-common.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gnu/egcs/gcc/c-common.c b/gnu/egcs/gcc/c-common.c index 6072d40c0e1..54f5f5918a6 100644 --- a/gnu/egcs/gcc/c-common.c +++ b/gnu/egcs/gcc/c-common.c @@ -2691,7 +2691,7 @@ check_format_info (info, params) && TREE_CODE (TREE_TYPE (cur_param)) == ARRAY_TYPE && TREE_CODE (TREE_TYPE (TREE_TYPE (cur_param))) == INTEGER_TYPE) { tree array_size_expr = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (cur_param))); - if (array_size_expr != 0) { + if (array_size_expr != 0 && TREE_CODE (array_size_expr) == INTEGER_CST) { int array_size = TREE_INT_CST_LOW (array_size_expr) + 1; #if 0 /* Gives false positives at the moment */ |