Hi David,
> > @@ -53,7 +54,7 @@ TYPEINIT1_FACTORY( SvxClipboardFmtItem, SfxPoolItem , new 
> >  SvxClipboardFmtItem(0
> >  SvxClipboardFmtItem_Impl::SvxClipboardFmtItem_Impl(
> >                              const SvxClipboardFmtItem_Impl& rCpy )
> >  {
> > -    aFmtIds.Insert( &rCpy.aFmtIds, 0 );
> > +    std::copy(rCpy.aFmtIds.begin(), rCpy.aFmtIds.end(), aFmtIds.begin());
> >      for( sal_uInt16 n = 0, nEnd = rCpy.aFmtNms.Count(); n < nEnd; ++n )
> >      {
> >          String* pStr = rCpy.aFmtNms[ n ];
> 
> This is totally wrong! The original line _inserts_ all items from
> rCpy.aFmtIds at the beginning of aFmtIds. std::copy _overwrites_ the
> first n elements of aFmtIds by items from the given range--this requires
> that aFmtIds has sufficient size. Since this is constructor, aFmtIds is
> always empty, therefore the line is practically guaranteed to corrupt
> memory (unless rCpy.aFmtIds is empty). I changed it to simple copy
> construction of aFmtIds from rCpy.aFmtIds.
Thanks, sorry for that. I thought if I am working on vector than i will
automatically resize, but I missed in description that I have to
manually resize.

Cheers,
        Maciej

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to