Changeset: 2a480474e571 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2a480474e571
Modified Files:
monetdb5/mal/mal_instruction.c
Branch: Jul2017
Log Message:
Protect MAL block
The number of variables should always be larger then the MAL instructions.
Upon enlarging the statement list, we should make sure there is sufficient
slack in the variable stack as well. The variable stack may contain
more entries then the stmt stack.
diffs (28 lines):
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -148,7 +148,6 @@ resizeMalBlk(MalBlkPtr mb, int elements)
{
int i;
- assert(mb->vsize >= mb->ssize);
if( elements > mb->ssize){
InstrPtr *ostmt = mb->stmt;
mb->stmt = (InstrPtr *) GDKrealloc(mb->stmt, elements *
sizeof(InstrPtr));
@@ -1408,13 +1407,15 @@ void
pushInstruction(MalBlkPtr mb, InstrPtr p)
{
int i;
+ int extra;
InstrPtr q;
if (p == NULL)
return;
+ extra = mb->vsize - mb->vtop; // the extra variables already known
if (mb->stop + 1 >= mb->ssize) {
- if( resizeMalBlk(mb, growBlk(mb->ssize)) ){
+ if( resizeMalBlk(mb, growBlk(mb->ssize) + extra) ){
/* perhaps we can continue with a smaller increment.
* But the block remains marked as faulty.
*/
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list