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

 
 

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

Submitted by:  Sandro Santilli <strk>
Submitted on:  Mon 30 Mar 2009 04:47:28 PM UTC  
 
Category: buildSeverity: 3 - Normal
Release: trunkStatus: Fixed
Privacy: PublicAssigned to: Rob Savoye <rsavoye>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission 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>
Project 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>
Project 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>
Project 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>
Project AdministratorIn charge of this item.
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>
Project 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>
Project 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>
Project 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>
Project Member

 

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

Attach File(s):
   
   
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
  • -unavailable- added by rsavoye (Posted a comment)
  • -unavailable- added by strk (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 14 Apr 2009 11:19:19 AM UTCstrkOpen/ClosedOpen=>Closed
    Mon 06 Apr 2009 06:11:30 PM UTCstrkOpen/ClosedClosed=>Open
    Fri 03 Apr 2009 06:27:23 PM UTCstrkOpen/ClosedOpen=>Closed
    Fri 03 Apr 2009 06:27:22 PM UTCstrkStatusReady For Test=>Fixed
    Thu 02 Apr 2009 01:49:01 PM UTCrsavoyeStatusNone=>Ready For Test
      Assigned toNone=>rsavoye
    Mon 30 Mar 2009 10:05:01 PM UTCstrkAttached File-=>Added test.cpp, #17842

    Back to the top


    Powered by Savane 3.1-cleanup1