Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 23 Mar 2013 01:25:04 +0100
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: Building unstable jumbo failed

On 22 Mar, 2013, at 15:51 , jfoug <jfoug@....net> wrote:
>> From: magnum Sent: Friday, March 22, 2013 4:16
>> 
>> FWIW, if I understand things right, representing a file format or network
> protocol
>> bitfield with a C bitfield is not guaranteed to be portable - the internal
>> representation of the bitfield is undefined. But I can't see anything we
> can
>> do about that if it's specified like this.
> 
> I do not think this is correct.  The warning could be output for a couple
> reasons.
> 
> 1. there is no way to 'legally' access a bit field as it actual layout.  The
> bitfield I fixed had all 16 bits used, and was 'exactly' a 16 bit integer in
> width.

Eating all bits to one uint16 with a union is not wrong. Swapping it is. Theoretically, a compiler can lay out those bits in any random order within that uint16 for whatever reason it picks. In reality, we are more likely to a) get it right, or b) end up swapping something that was correct.

> 2. the bit field was not at a 16 bit offset, due to byte packing of the
> structure, and location within the structure.

That is a separate problem but we should ideally address that too.

magnum

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ