Changeset: aede89c7521b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aede89c7521b
Modified Files:
monetdb5/mal/mal_atom.c
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_debugger.c
monetdb5/mal/mal_import.c
Branch: Jan2014
Log Message:
A few Coverity fixes
Out of bound issues and memleaks
diffs (52 lines):
diff --git a/monetdb5/mal/mal_atom.c b/monetdb5/mal/mal_atom.c
--- a/monetdb5/mal/mal_atom.c
+++ b/monetdb5/mal/mal_atom.c
@@ -110,7 +110,7 @@ int malAtomProperty(MalBlkPtr mb, InstrP
assert(pci != 0);
name = getFunctionId(pci);
tpe = getTypeIndex(getModuleId(pci), (int)strlen(getModuleId(pci)),
TYPE_any);
- if (tpe < 0 || tpe >= GDKatomcnt)
+ if (tpe < 0 || tpe >= GDKatomcnt || tpe >= MAXATOMS)
return 0;
assert(pci->fcn != NULL);
switch (name[0]) {
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -422,7 +422,7 @@ pushNilType(MalBlkPtr mb, InstrPtr q, ch
if (q == NULL)
return NULL;
idx= getTypeIndex(tpe, -1, TYPE_any);
- if( idx < 0)
+ if( idx < 0 || idx >= GDKatomcnt || idx >= MAXATOMS)
return NULL;
cst.vtype=TYPE_void;
cst.val.oval= oid_nil;
diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -1178,8 +1178,7 @@ str
runMALDebugger(Client cntxt, Symbol s)
{
cntxt->itrace = 'n';
- runMAL(cntxt, s->def, 0, 0);
- return MAL_SUCCEED;
+ return runMAL(cntxt, s->def, 0, 0);
}
/* Utilities
diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -391,8 +391,10 @@ callString(Client c, str s, int listing)
if (old != s)
GDKfree(s);
b = (buffer *) GDKmalloc(sizeof(buffer));
- if (b == NULL)
+ if (b == NULL){
+ GDKfree(qry);
return -1;
+ }
buffer_init(b, qry, len);
if (MCpushClientInput(c, bstream_create(buffer_rastream(b,
"callString"), b->len), listing, "") < 0) {
GDKfree(b);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list