www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - [stlsoft] Bug in pod_vector<T, A, SPACE>::pod_vector(class_type const&

reply =?UTF-8?B?Q2hyaXN0aWFuIFLDtnNzZWw=?= <christian.roessel gmx.de> writes:
Hi Matthew,

the copy-ctor accesses rhs[0] in

    pod_copy_n(begin_(), &rhs[0], size());

If rhs is empty, we get a "Requested index is out of range" assertion. A
possible fix is:

    if (! rhs.empty()) {
      pod_copy_n(begin_(), &rhs[0], size());
    }

Is this workaround sufficcient or do I miss something?
I found this bug in 1.9.42 and 1.9.45.

Best regards,
Christian
Aug 08 2008
next sibling parent Matthew <matthewwilson acm.org> writes:
Hi Christian

I'm working on this right now. The fix is to change line 489 to 

    pod_copy_n(begin_(), rhs.begin_(), size());

This has caused me to finally start the release of the new (1.10+) STLSoft
unit-testing facility, which you should see available on the site sometime in
the next day or so.

Thanks

Matt

Christian Rössel Wrote:

 Hi Matthew,
 
 the copy-ctor accesses rhs[0] in
 
     pod_copy_n(begin_(), &rhs[0], size());
 
 If rhs is empty, we get a "Requested index is out of range" assertion. A
 possible fix is:
 
     if (! rhs.empty()) {
       pod_copy_n(begin_(), &rhs[0], size());
     }
 
 Is this workaround sufficcient or do I miss something?
 I found this bug in 1.9.42 and 1.9.45.
 
 Best regards,
 Christian

Aug 09 2008
prev sibling parent Matt Wilson <matthewwilson acm.org> writes:
The release of 1.9.46 takes into account this defect (and several others).

Cheers

Matt

Christian Rössel Wrote:

 Hi Matthew,
 
 the copy-ctor accesses rhs[0] in
 
     pod_copy_n(begin_(), &rhs[0], size());
 
 If rhs is empty, we get a "Requested index is out of range" assertion. A
 possible fix is:
 
     if (! rhs.empty()) {
       pod_copy_n(begin_(), &rhs[0], size());
     }
 
 Is this workaround sufficcient or do I miss something?
 I found this bug in 1.9.42 and 1.9.45.
 
 Best regards,
 Christian

Aug 11 2008