Fixed a nasty compiler bug where if the rhs of a ternary operator was larger than the lhs, the copy length emitted would only fit the lhs. The hier13() function now returns the larger of the lvalue sizes. (bug amb1853)
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402521
This commit is contained in:
parent
99d27b979d
commit
9ca1ca62ea
@ -1346,6 +1346,15 @@ static int hier13(value *lval)
|
||||
if ((array1 && array2) && (total1 && total2)) {
|
||||
markheap(MEMUSE_DYNAMIC, 0);
|
||||
}
|
||||
/* If both sides are arrays, we should return the maximal as the lvalue.
|
||||
* Otherwise we could buffer overflow and the compiler is too stupid.
|
||||
* Literal strings have a constval == -(num_cells) so the cmp is flipped.
|
||||
*/
|
||||
if (lval->ident==iARRAY && lval2.ident==iARRAY
|
||||
&& lval->constval < 0
|
||||
&& lval->constval > lval2.constval) {
|
||||
*lval = lval2;
|
||||
}
|
||||
if (lval->ident==iARRAY)
|
||||
lval->ident=iREFARRAY; /* iARRAY becomes iREFARRAY */
|
||||
else if (lval->ident!=iREFARRAY)
|
||||
|
Loading…
Reference in New Issue
Block a user