Changeset: 85125901b079 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=85125901b079
Modified Files:
        monetdb5/extras/rdf/rdfschema.c
Branch: rdf
Log Message:

defensive programming: prevent segfault


diffs (31 lines):

diff --git a/monetdb5/extras/rdf/rdfschema.c b/monetdb5/extras/rdf/rdfschema.c
--- a/monetdb5/extras/rdf/rdfschema.c
+++ b/monetdb5/extras/rdf/rdfschema.c
@@ -1676,6 +1676,12 @@ str RDFrelationships(int *ret, BAT *sbat
        oid             returnSubCSid; 
        char*           buffTypes; 
 
+       if (BATcount(sbat) == 0) {
+               throw(RDF, "rdf.RDFrelationships", "sbat must not be empty");
+               /* otherwise, variable sbt is not initialized and thus
+                * cannot be dereferenced after the BATloop below */
+       }
+
        buffTypes = (char *) malloc(sizeof(char) * (maxNumPwithDup + 1)); 
 
        numPwithDup = 0;
@@ -1898,6 +1904,14 @@ RDFextractPfromPSO(int *ret, bat *pbatid
                BBPreleaseref(sbat->batCacheid);
                throw(MAL, "rdf.RDFextractCS", RUNTIME_OBJECT_MISSING);
        }
+
+       if (BATcount(pbat) == 0) {
+               BBPreleaseref(sbat->batCacheid);
+               BBPreleaseref(pbat->batCacheid);
+               throw(RDF, "rdf.RDFextractPfromPSO", "pbat must not be empty");
+               /* otherwise, variable bt is not initialized and thus
+                * cannot be dereferenced after the BATloop below */
+       }
        
        si = bat_iterator(sbat); 
        pi = bat_iterator(pbat); 
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to