bugGnash - The GNU Flash player - Bugs: bug #26051, Ubuntu-arm: htons returns unsigned...

 
 

bug #26051: Ubuntu-arm: htons returns unsigned int ?

Submitter:  Sandro Santilli <strk>
Submitted:  Mon 30 Mar 2009 04:47:28 PM UTC
   
 
Category:  build Severity:  3 - Normal
Release:  trunk Status:  Fixed
Privacy:  Public Assigned to:  rsavoye
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 14 Apr 2009 11:19:19 AM UTC, comment #7: 

Closed as it's been merged in trunk now.

Sandro Santilli <strk>
Group Member
Mon 06 Apr 2009 06:11:30 PM UTC, comment #6: 

I'm reopening this, as it's not being merged to trunk yet.
To be closed when it is.

Sandro Santilli <strk>
Group Member
Fri 03 Apr 2009 06:27:23 PM UTC, comment #5: 

Built successfully on arm. Also, nearby code looks fine (for operator+=).

Sandro Santilli <strk>
Group Member
Thu 02 Apr 2009 01:49:01 PM UTC, comment #4: 

I fixed this in the rtmp branch by using a real short to hold the results of being swapped by htons, which is commonly used elsewhere in the code. This code works for me, and is valgrind clean. If it works for you, I'll do the same to trunk., and consider this closed.

Rob Savoye <rsavoye>
Group administrator
Mon 30 Mar 2009 10:27:25 PM UTC, comment #3: 

For the record, the version on Fedora (also affected by the bug):

gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)

Sandro Santilli <strk>
Group Member
Mon 30 Mar 2009 10:05:01 PM UTC, comment #2: 

So, it turns out this is due to a bug in optimizer
for  g++ (Ubuntu 4.3.2-2ubuntu11) 4.3.3 20090111 (prerelease)

Attached is a testcase, run with -O2 or -O0 and you get
htons(unsigned short) return 'unsigned int' (-O2) or 'unsigned short' (-O0).

Rob reports it to be a problem on a Fedora with 4.3.2 too.

Note that when htons() return is passed to amf::Buffer::operator+
the 'int' vs. 'short' problem goes unnoticed at compile time
because the operator is overloaded to support both 16 and 32 bit
integers, but hurts at run time in that appends more or less bytes
to an encoded AMF.

(file #17842)

Sandro Santilli <strk>
Group Member
Mon 30 Mar 2009 08:33:40 PM UTC, comment #1: 

Just a note: I did add the <arpa/inet.h> include (it's committed to trunk already), but didn't help.

Sandro Santilli <strk>
Group Member
Mon 30 Mar 2009 04:47:28 PM UTC, original submission:  

 ARM (qemu)

 trunk/libamf/amf_msg.cpp:46: error: invalid cast from type 'unsigned int' to type 'uint16_t'

  46:   *buf = htons(version);

 sizeof(boost::uint16_t):2
 sizeof(unsigned int):4 <-- this is what seems to be returned by htons ?

 (using C style cast fixes this, but it's plain WRONG)

 Note that further use of += operator with htons isn't a problem
 (no idea why)

Sandro Santilli <strk>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #17842:  test.cpp added by strk (368B - text/x-c++src)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rsavoye (Posted a comment)
  • -email is unavailable- added by strk (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-04-14 strk Open/ClosedOpen Closed
    2009-04-06 strk Open/ClosedClosed Open
    2009-04-03 strk Open/ClosedOpen Closed
    2009-04-03 strk StatusReady For Test Fixed
    2009-04-02 rsavoye StatusNone Ready For Test
        Assigned toNone rsavoye
    2009-03-30 strk Attached File- Added test.cpp, #17842

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code