Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 625 by f.volej...@gmail.com: Exception safety issues in RepeatedPtrField
http://code.google.com/p/protobuf/issues/detail?id=625

Hello,

the method RepeatedPtrFieldBase::Add has a exception safety problem, which reveals itself when TypeHandler::New throws an exception (for example out of memory exceptions).

The result is that allocated_size_ gets incremented, but the elements_ array does not get the element initialized, leading to segmentation faults when working with the repeated ptr field or upon it's destruction.

I propose a fix fir this issue by incrementing the allocated_size_ only after the allocation succeeds.

Attachments:
        exception_safety.patch  516 bytes

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to