overflow detection

This commit is contained in:
Lev Walkin 2005-05-17 21:46:18 +00:00
parent fece88afec
commit 88693e88ce
2 changed files with 22 additions and 4 deletions

View File

@ -1,4 +1,9 @@
0.9.15: 2005-May-17
* Compiler now checks 64-bit overflows in constraints range handling
code. No effect on the code produced by the compiler.
0.9.14: 2005-Apr-29
* Fixed check-70.-fnative-integers.c test (it was failing

View File

@ -453,28 +453,40 @@ _range_split(asn1cnst_range_t *ra, const asn1cnst_range_t *rb) {
* L: |---...
* R: |--..
*/
if(ll < 0) {
while(ll < 0) {
nr->left = ra->left;
nr->right = rb->left;
if(nr->right.type == ARE_VALUE)
if(nr->right.type == ARE_VALUE) {
if(nr->right.value - 1 >= nr->right.value) {
/* We've hit the limit here. */
break;
}
nr->right.value--;
}
_range_insert(range, nr);
nr = _range_new();
assert(nr);
break;
}
/*
* L: ...---|
* R: ..--|
*/
if(rr > 0) {
while(rr > 0) {
nr->left = rb->right;
nr->right = ra->right;
if(nr->left.type == ARE_VALUE)
if(nr->left.type == ARE_VALUE) {
if(nr->left.value + 1 <= nr->left.value) {
/* We've hit the limit here. */
break;
}
nr->left.value++;
}
_range_insert(range, nr);
nr = _range_new();
assert(nr);
break;
}
/*
@ -556,6 +568,7 @@ _range_intersection(asn1cnst_range_t *range, const asn1cnst_range_t *with, int s
wel = with;
} else {
wel = with->elements[j];
assert(!wel->el_count); /* non-compound item! */
}
r = _range_split(range->elements[i], wel);