Thread overview
[stlsoft] Bug in pod_vector<T, A, SPACE>::pod_vector(class_type const& rhs)
Aug 08, 2008
Christian Rössel
Re: [stlsoft] Bug in pod_vector<T, A, SPACE>::pod_vector(class_type const&
Aug 09, 2008
Matthew
Aug 11, 2008
Matt Wilson
August 08, 2008
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
August 09, 2008
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

August 11, 2008
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