|
Boost Users : |
Subject: Re: [Boost-users] "invalid signature" in boost::archive::binary_iarchive
From: Ibrahim Beicker (ibrabeicker_at_[hidden])
Date: 2012-05-28 09:58:57
thanks for your help, but I ended up discovering that the message was
*unaligned
*4 bytes to the right, with x00 x00 x00 x00 x22 when the message should
start with x22, hence the invalid signature.
The problem was with the constructor of boost::asio::buffer, it was
boost::asio::buffer(&m_messageSize, sizeof(unsigned int)) when it should be
boost::asio::buffer(&m_messageSize, sizeof(std::size_t))
since in 64 bits sizeof(unsigned int) = 4 and sizeof(size_t) is 8
problem solved
2012/5/28 Jeff Flinn <Jeffrey.Flinn_at_[hidden]>
> On 5/25/2012 2:44 PM, Ibrahim Beicker wrote:
>
>> I had to port a multi-process application to 64 bits and I rely on boost
>> serialization to send messages, that are maps of key-values, into
>> Microsoft queues to the other modules. It works just fine into 32 bits
>> but when I run it in 64 the constructor throws an "invalid signature"
>> exception
>>
>> void Message::fromBinary( const std::string& data )
>> {
>> std::stringstream ss;
>> ss << data;
>> boost::archive::binary_**iarchive ia(ss); //exception here
>>
>> ia >> *this;
>> }
>>
>
> Have you tried:
>
>
> void Message::fromBinary( const std::string& data )
> {
> std::istringstream ss(data, std::ios::binary);
>
>
> boost::archive::binary_**iarchive ia(ss); //exception here
>
> ia >> *this;
> }
>
> The output side should be opened with "binary" as well. I'm surprised this
> didn't cause problems with 32bit as well.
>
> Jeff
>
>
> ______________________________**_________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/**mailman/listinfo.cgi/boost-**users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net