Hi,
I am using a straightforward C++ client to fetch GTFS-realtime feeds. Feeds
are read into a string with libcurl and than parsed:
GOOGLE_PROTOBUF_VERIFY_VERSION;
FeedMessage fm;
/** fetching realtime feed with libcurl into readBuffer **/
if (!fm.ParseFromString(readBuffer)) { // this line crashes
LOG(ERROR) << "Failed to parse realtime GTFS.";
return;
}
I experience random segfault crashes during parsing. All of them oocure
while parsing a very specific feed. The segfault is caused by
google::protobuf::DescriptorPool::FindFileByName
Backtrace:
Program received signal SIGSEGV, Segmentation fault.
#0 0x00007ffff7901f3e in
google::protobuf::DescriptorPool::FindFileByName(std::string const&) const
() from /usr/lib/libprotobuf.so.7
#1 0x000000000047e045 in
transit_realtime::protobuf_AssignDesc_headers_2fprotobuf_2fgtfs_2drealtime_2eproto()
() at headers/protobuf/gtfs-realtime.pb.cc:80
#2 0x00007ffff7683400 in pthread_once ()
at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S:104
#3 0x0000000000471593 in transit_realtime::FeedMessage::GetMetadata() const
() at /usr/include/google/protobuf/stubs/once.h:115
#4 0x00007ffff7932274 in google::protobuf::Message::GetTypeName() const ()
from /usr/lib/libprotobuf.so.7
#5 0x00007ffff78e2f17 in ?? () from /usr/lib/libprotobuf.so.7
#6 0x00007ffff78e3714 in
google::protobuf::MessageLite::ParseFromString(std::string const&) () from
/usr/lib/libprotobuf.so.7
Since the segfaults are _always_ caused by the same feed, I strongly
suspect that it is bad data that causes the crash. The random nature of the
crashes could be explained by the feed returning a bad message every few
few hours. Nevertheless, for bad data, ParseFromString() should return
false, and not crash completely.
I am using g++ 4.8.1 with -O3 -g -std=c++0x
protoc --version returns "libprotoc 2.4.1"
Thanks for any help :)
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.