wrong bitmask format for insertion/removal schemes of list compression

Bug #778541 reported by Klaus Warnke
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rohc
Status tracked in Rohc-main
1.2.x
Won't Fix
Medium
Didier Barvaux
1.3.x
Won't Fix
Medium
Didier Barvaux
Rohc-main
Fix Released
Medium
Didier Barvaux

Bug Description

bug in encode_type_2() in c_generic.c:

test: ipv4/ipv6ext/udp/rtp/video1
packet 20: hop-by-hop and destination header.
packet 21: hop-by-hop and destination header disappear

c_generic.c line 1674

Function does not take difference between 7bit and 15bit mask into accout.

In the first octet are only 7bit available, not 8.
And bit 0 is 0.

See 3095: 5.8.6.2.

           0 1 2 3 4 5 6 7
         +---+---+---+---+---+---+---+---+
         | 0 | 7-bit mask | bit 1 is the first bit
         +---+---+---+---+---+---+---+---+

         +---+---+---+---+---+---+---+---+
         | 1 | | bit 1 is the first bit
         +---+ 15-bit mask +
         | | bit 7 is the last bit
         +---+---+---+---+---+---+---+---+

Revision history for this message
Klaus Warnke (k-warnke) wrote :

to fix:

replace near line 1672:

          byte = 0xff;
with
        if (size > 7) byte = 0xff; /* 15 bit mask */
        else byte = 0x7f; /* 7 bit mask */

and so on:
        for(i = 0; i<size && i < 8; i++)
        for(i = 0; i<size && i < 7; i++) // only 7

                        byte &= ~(1 << (7 - i));
                        byte &= ~(1 << (6 - i));

        if (size > 8)
        if (size > 7) // 8 to 15

                for(i = 8; i<size && i < 16; i++)
                for(i = 7; i<size && i < 15; i++)

                                j = i - 8;
                                j = i - 7;

Revision history for this message
Klaus Warnke (k-warnke) wrote :

This fix adds the 7bit/15bit mask handling.

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Confirmed on the 1.2.x branch.

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Confirmed on the 1.3.x branch.

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Confirmed on the trunk.

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Will not be fixed on the 1.2.x branch as it would break compatibility with previous 1.2.x releases. A note was added to the README file.

summary: - ipv6 ext encode_type_2(): missed 7bit/15bit mask handling
+ wrong bitmask format for insertion/removal schemes of list compression
Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Will not be fixed on the 1.3.x branch as it would break compatibility with previous 1.3.x releases. A note was added to the README file. See http://bazaar.launchpad.net/~didier-barvaux/rohc/1.3.x/revision/174

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Thanks Klaus for the provided patch! It looks great. However it seems that it does never set the first bit (0 for 7-bit mask, 1 for 15-bit mask) at compressor. Am I missing something?

Revision history for this message
Klaus Warnke (k-warnke) wrote :

This was the change, if I remember correct:

- byte = 0xff;
+ byte = (size > 7) ? 0xff : 0x7f;

On size > 7 the bit is 1 (0xff: 1111 1111), for 7 values or less the bit is 0 (0x7f: 0111 1111).

Or more readable:

 if (size > 7) byte = 0xff; /* 15 bit mask */
 else byte = 0x7f; /* 7 bit mask */

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

OK, you're right for the removal masks. However it seems that the first bit is not set for insertion masks. What do you think of adding the following code for insertion mask?

if(size > 7)
  byte |= 1 << 7;
else
  byte &= 0x7f;

The else part may probably be omitted since byte is initialized to 0.

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Fix committed in trunk. See http://bazaar.launchpad.net/~didier-barvaux/rohc/main/revision/300

Thanks to Klaus Warnke for reporting the bug, for the analysis and his patch !

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Commit small fixes to avoid build warnings with GCC 4.1, GCC 4.3, GCC 4.4 and GCC 4.6. See http://bazaar.launchpad.net/~didier-barvaux/rohc/main/revision/301.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.