[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-dev] Gnash 0.8.4 bug fixes
From: |
Andreas Schwab |
Subject: |
[Gnash-dev] Gnash 0.8.4 bug fixes |
Date: |
Tue, 14 Oct 2008 19:19:09 +0200 |
User-agent: |
Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux) |
This patch fixes a few bugs in gnash 0.8.4:
amf::Buffer::copy(Network::byte_t): sizeof(bool) has no connection to
the size of a byte.
amf::RTMPServer::encodePing(rtmp_ping_e, boost::uint32_t) and
amf::RTMP::encodeHeader(int, rtmp_headersize_e, size_t, content_types_e,
RTMPMsg::rtmp_source_e): do correct byte swapping (fixes strict
alignment violation)
amf::RTMP::decodeHeader(Network::byte_t *): remove spurious 4 bits of
padding.
Andreas.
=== modified file 'libamf/buffer.cpp'
--- libamf/buffer.cpp 2008-08-02 22:55:21 +0000
+++ libamf/buffer.cpp 2008-10-14 17:04:48 +0000
@@ -169,7 +169,7 @@
{
GNASH_REPORT_FUNCTION;
*_ptr = val;
- _seekptr = _ptr + sizeof(bool);
+ _seekptr = _ptr + sizeof(Network::byte_t);
}
#if 0
=== modified file 'libnet/rtmp.cpp'
--- libnet/rtmp.cpp 2008-09-04 15:17:06 +0000
+++ libnet/rtmp.cpp 2008-10-14 17:02:09 +0000
@@ -260,7 +260,7 @@
if (_header.head_size >= 4) {
_mystery_word = *tmpptr++;
- _mystery_word = (_mystery_word << 12) + *tmpptr++;
+ _mystery_word = (_mystery_word << 8) + *tmpptr++;
_mystery_word = (_mystery_word << 8) + *tmpptr++;
log_debug(_("The mystery word is: %d"), _mystery_word);
@@ -268,7 +268,7 @@
if (_header.head_size >= 8) {
_header.bodysize = *tmpptr++;
- _header.bodysize = (_header.bodysize << 12) + *tmpptr++;
+ _header.bodysize = (_header.bodysize << 8) + *tmpptr++;
_header.bodysize = (_header.bodysize << 8) + *tmpptr++;
_header.bodysize = _header.bodysize & 0xffffff;
log_debug(_("The body size is: %d"), _header.bodysize);
@@ -381,17 +381,9 @@
// and add the type of the object if the header size is 8 or more.
// length is a 3 byte field
if ((head_size == HEADER_8) || (head_size == HEADER_12)) {
-#ifdef BOOST_BIG_ENDIAN
- boost::uint32_t length = total_size << 8;
-#else
- boost::uint32_t length = (htonl(*reinterpret_cast<boost::uint32_t
*>(&total_size))) >> 8;
-#endif
- memcpy(ptr, &length, 3);
-// #else
-// #error "No Endianess specified!"
-// #endif
-//#endif
- ptr += 3;
+ *ptr++ = (total_size >> 16) & 0xff;
+ *ptr++ = (total_size >> 8) & 0xff;
+ *ptr++ = total_size & 0xff;
// The type is a one byte field
*ptr = type;
ptr++;
@@ -399,7 +391,8 @@
// Add the routing of the message if the header size is 12, the maximum.
if (head_size == HEADER_12) {
- memcpy(ptr, &routing, 4);
+ boost::uint32_t swapped = htonl(routing);
+ memcpy(ptr, &swapped, 4);
ptr += 4;
}
=== modified file 'libnet/rtmp_server.cpp'
--- libnet/rtmp_server.cpp 2008-09-03 20:46:15 +0000
+++ libnet/rtmp_server.cpp 2008-10-14 17:04:03 +0000
@@ -628,11 +628,7 @@
Network::byte_t *ptr = buf->reference();
buf->clear(); // default everything to zeros, real data gets
optionally added.
- boost::uint32_t field = htonl(*reinterpret_cast<boost::uint32_t *>(&type));
-#ifdef BOOST_LITTLE_ENDIAN
- field = field >> 16;
-#endif
- boost::uint16_t typefield = static_cast<boost::uint16_t>(field);
+ boost::uint16_t typefield = htons(type);
ptr += sizeof(boost::uint16_t); // go past the first short
boost::uint32_t swapped = 0;
--
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
- [Gnash-dev] Gnash 0.8.4 bug fixes,
Andreas Schwab <=