On Wed, Sep 10, 2008 at 10:36:27AM +0000, Martin Kersten wrote:
Update of /cvsroot/monetdb/MonetDB5/src/modules/mal In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17819
Modified Files: tablet.mx Log Message: More defenses.
U tablet.mx Index: tablet.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet.mx,v retrieving revision 1.170 retrieving revision 1.171 diff -u -d -r1.170 -r1.171 --- tablet.mx 10 Sep 2008 09:30:16 -0000 1.170 +++ tablet.mx 10 Sep 2008 10:36:19 -0000 1.171 @@ -1964,10 +1964,12 @@ for( i=0; i< (int)as->nr_attrs; i++) { if (as->format[i].c) { /* prepare enough space */ - BATextend( as->format[i].c, cnt ); + as->format[i].c = BATextend( as->format[i].c, cnt ); + assert(as->format[i].c != NULL);
Assertions are (usually) ment for ensuring consistency of the code and its usage and (hence) to detect situations that may/must ("can") not occur under "normal" circumstances; A BATextend (i.e., a malloc) can very well fail in normal circumstance (e.g., when running out of memory); hence, such a situation should (must?) better be detected and handled by some error handling code, not by an assertion; Recall and be aware that assertions are disabled in the release production version, i.e., in this case a failing BATextend (e.g., due to shortage of memory or address space) will lead to undefined behavor of the code, potentially a segmentation fault. This is IMHO not desired ... Stefan
for (j=0; j
format[i].c); - BATappend(as->format[i].c, partition[j]->format[i].c,TRUE); + as->format[i].c= BATappend(as->format[i].c, partition[j]->format[i].c,TRUE); + assert(as->format[i].c!= NULL); BATsave(as->format[i].c); /* Throw away the temporary bats a.s.a.p. without saveing */ BBPunfix(partition[j]->format[i].c->batCacheid); ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |