[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 11/29: zeromq: fix segfault in tag_headers
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 11/29: zeromq: fix segfault in tag_headers |
Date: |
Tue, 13 Jan 2015 01:04:27 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit c1f42c12af1b4deedf7d72c477b40d4cc369ee41
Author: Johnathan Corgan <address@hidden>
Date: Fri Oct 31 16:01:19 2014 -0700
zeromq: fix segfault in tag_headers
---
gr-zeromq/lib/tag_headers.cc | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/gr-zeromq/lib/tag_headers.cc b/gr-zeromq/lib/tag_headers.cc
index b45025d..42a65be 100644
--- a/gr-zeromq/lib/tag_headers.cc
+++ b/gr-zeromq/lib/tag_headers.cc
@@ -33,10 +33,12 @@ namespace gr {
std::stringstream ss;
size_t ntags = tags.size();
- ss.write( reinterpret_cast< const char* >( offset ), sizeof(uint64_t) );
// offset
+ ss.write( reinterpret_cast< const char* >( &offset ), sizeof(uint64_t)
); // offset
ss.write( reinterpret_cast< const char* >( &ntags ), sizeof(size_t) );
// num tags
std::stringbuf sb("");
+ std::cout << "TX TAGS: (offset="<<offset<<" ntags="<<ntags<<")\n";
for(size_t i=0; i<tags.size(); i++){
+ std::cout << "TX TAG: (" << tags[i].offset << ", " << tags[i].key <<
", " << tags[i].value << ", " << tags[i].srcid << ")\n";
ss.write( reinterpret_cast< const char* >( &tags[i].offset ),
sizeof(uint64_t) ); // offset
sb.str("");
pmt::serialize( tags[i].key, sb );
// key
@@ -51,17 +53,28 @@ namespace gr {
std::string
parse_tag_header(std::string &buf_in, uint64_t &offset_out,
std::vector<gr::tag_t> tags_out) {
+ std::cout << "sblen: " << buf_in.size() <<"\n";
std::istringstream iss( buf_in );
size_t rcv_ntags;
iss.read( (char*)&offset_out, sizeof(uint64_t ) );
iss.read( (char*)&rcv_ntags, sizeof(size_t ) );
+ std::cout << "RX TAGS: (offset="<<offset_out<<"
ntags="<<rcv_ntags<<")\n";
+ int rd_offset = sizeof(uint64_t) + sizeof(size_t);
for(size_t i=0; i<rcv_ntags; i++){
gr::tag_t newtag;
iss.read( (char*)&newtag.offset, sizeof(uint64_t ) );
- std::stringbuf sb( iss.str() );
+ rd_offset += sizeof(uint64_t);
+
+ std::stringbuf sb( iss.str().substr(rd_offset) );
+ std::cout << "sblen: " << sb.str().size() << "\n";
+ std::cout << "sbloc: " << sb.getloc() << "\n";
+ //std::stringbuf sb( iss.str() );
+
newtag.key = pmt::deserialize( sb );
newtag.value = pmt::deserialize( sb );
newtag.srcid = pmt::deserialize( sb );
+ std::cout << "sblen(after): " << sb.str().size() << "\n";
+ std::cout << "sbloc(after): " << sb.getloc() << "\n";
tags_out.push_back(newtag);
iss.str(sb.str());
}
- [Commit-gnuradio] [gnuradio] branch master updated (5cb307e -> 1581681), git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 13/29: zmq: adding header information, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 11/29: zeromq: fix segfault in tag_headers,
git <=
- [Commit-gnuradio] [gnuradio] 16/29: zmq: naming cleanup, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 17/29: zmq: pull_msg_source should be working, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 20/29: zeromq: cleanup and convert pub_msg_sink to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 23/29: zeromq: cleanup and made pull_msg_source derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 07/29: zmq: all source blocks should now support tag headers, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 06/29: zmq: hoisting tag parsing into helper function, should now be easy to use in other zmq blocks, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 14/29: zmq: Adding zmq pub/sub blocks for message passing, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 21/29: zeromq: cleanup and convert sub_msg_source to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 22/29: zeromq: cleanup and converted push_msg_sink to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 01/29: zmq: encoding tags into zmq stream, git, 2015/01/12