[Monetdb-developers] [Monetdb-checkins] MonetDB4/src/modules/contrib malalgebra.mx, MonetDB_4-24, 1.8.2.2, 1.8.2.3

Stefan Manegold Stefan.Manegold at cwi.nl
Mon Nov 3 23:15:16 CET 2008


On Mon, Nov 03, 2008 at 11:09:15PM +0100, Sjoerd Mullender wrote:
> Did you see what I had done on the head branch for this problem?

yes --- but is does (IMHO) not help:
in both cases, BUNins (into a [lng,BAT] BAT) was/is called with a *size_t or
*BUN argument for the head value, which will than be dereferences as lng ---
a 4 byte vs. 8 byte mismatch in case size_t (or BUN) is 32-bit ...

Stefan

ps: yes, my "fix" will require some (local "minor") manual conflict-fixing
    during propagattion --- I'll take care of that once Riham has checked my
    "fix" ...

> On 2008-11-03 22:51, Stefan Manegold wrote:
> > Update of /cvsroot/monetdb/MonetDB4/src/modules/contrib
> > In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv6583/MonetDB4/src/modules/contrib
> > 
> > Modified Files:
> >       Tag: MonetDB_4-24
> > 	malalgebra.mx 
> > Log Message:
> > 
> > attempt to fix bug in Peter's new {band,left}mergejoin_limit() functions
> > that was reported by Riham:
> > 
> > While {band,left}mergejoin_limit() internally use a limit of type size_t,
> > the MIL level uses type lng; hence, we need to properly convert the types
> > back and forth (and check for potential under-/overflows).
> > 
> > (For now, I did not dare to change the MIL interface to use the more suitable
> >  type wrd that (unlike lng) grows with system word size just like size_t.)
> > 
> > Riham,
> > 
> > could you please check, whether this fixes your problem?
> > Thanks!
> > 
> > 
> > 
> > U malalgebra.mx
> > Index: malalgebra.mx
> > ===================================================================
> > RCS file: /cvsroot/monetdb/MonetDB4/src/modules/contrib/malalgebra.mx,v
> > retrieving revision 1.8.2.2
> > retrieving revision 1.8.2.3
> > diff -u -d -r1.8.2.2 -r1.8.2.3
> > --- malalgebra.mx	28 Oct 2008 17:49:34 -0000	1.8.2.2
> > +++ malalgebra.mx	3 Nov 2008 21:51:09 -0000	1.8.2.3
> > @@ -263,28 +263,50 @@
> >  }
> >  
> >  int
> > -CMDbandmergejoin_limit(BAT **result, BAT *left, BAT *right, ptr minus, ptr plus, bit *li, bit *hi, lng* limit)
> > +CMDbandmergejoin_limit(BAT **result, BAT *left, BAT *right, ptr minus, ptr plus, bit *li, bit *hi, lng* _limit)
> >  {
> > -	size_t cutoff = *limit;
> > +        lng limit = *_limit;
> > +        size_t cutoff = (size_t) limit;
> > +        assert(limit >= 0);
> > +#if SIZEOF_SIZE_T == SIZEOF_INT
> > +        assert(limit <= GDK_int_max);
> > +#endif
> >          *result = BATbandmergejoin_limit(left, right, minus, plus, *li, *hi, &cutoff);
> >          if (*result) {
> >                  bat bid = (*result)->batCacheid;
> >                  *result = BATnew(TYPE_lng, TYPE_bat, 1);
> > -                if (*result) BUNins(*result, &cutoff, &bid, FALSE);
> > +                if (*result) {
> > +#if SIZEOF_SIZE_T == SIZEOF_LNG
> > +                        assert(cutoff <= (size_t) GDK_lng_max);
> > +#endif
> > +                        limit = (lng) cutoff;
> > +                        BUNins(*result, &limit, &bid, FALSE);
> > +                }
> >                  BBPunfix(bid);
> >          }
> >          return (*result)?GDK_SUCCEED:GDK_FAIL;
> >  }
> >  
> >  int
> > -CMDleftmergejoin_limit(BAT **result, BAT *left, BAT *right, lng* limit)
> > +CMDleftmergejoin_limit(BAT **result, BAT *left, BAT *right, lng* _limit)
> >  {
> > -	size_t cutoff = *limit;
> > +        lng limit = *_limit;
> > +        size_t cutoff = (size_t) limit;
> > +        assert(limit >= 0);
> > +#if SIZEOF_SIZE_T == SIZEOF_INT
> > +        assert(limit <= GDK_int_max);
> > +#endif
> >          *result = BATleftmergejoin_limit(left, right, cutoff, &cutoff);
> >          if (*result) {
> >                  bat bid = (*result)->batCacheid;
> >                  *result = BATnew(TYPE_lng, TYPE_bat, 1);
> > -                if (*result) BUNins(*result, &cutoff, &bid, FALSE);
> > +                if (*result) {
> > +#if SIZEOF_SIZE_T == SIZEOF_LNG
> > +                        assert(cutoff <= (size_t) GDK_lng_max);
> > +#endif
> > +                        limit = (lng) cutoff;
> > +                        BUNins(*result, &limit, &bid, FALSE);
> > +                }
> >                  BBPunfix(bid);
> >          }
> >          return (*result)?GDK_SUCCEED:GDK_FAIL;
> > 
> > 
> > -------------------------------------------------------------------------
> > 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 at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
> 
> 
> -- 
> Sjoerd Mullender
> 
> -------------------------------------------------------------------------
> 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
> 

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at 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       |




More information about the developers-list mailing list