[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libredwg] Decode R2004 version

From: Till Heuschmann
Subject: Re: [libredwg] Decode R2004 version
Date: Mon, 29 Jul 2013 22:33:31 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

Write the struct definition like this:

#pragma pack(push,2)
        unsigned char encripted_data[0x6c];
        int32_t x00;
    } _2004_header_data;
#pragma pack(pop)

This will force the compiler to align the fields at a 2 Byte boundary and a sizeof(_2004_header_data) will result in 108 Bytes.

Should even work for gcc:

Am 28.07.2013 11:53, schrieb Avneet Kaur:
On Thu, Jul 4, 2013 at 1:57 AM, Till Heuschmann <address@hidden> wrote:
but resized some of them from 32 Bit to 64 Bit. In combination that is

When we resized the variables (changing the data type too when log
tracing these) as following new version of specs,

      unsigned char file_ID_string[12];
      int32_t x00;
      int32_t x6c;
      int32_t x04;
      int32_t root_tree_node_gap;
      int32_t lowermost_left_tree_node_gap;
      int32_t lowermost_right_tree_node_gap;
      int32_t unknown_long;
      int32_t last_section_page_id;
      int64_t last_section_page_end_address;
      int64_t second_header_address;
      int32_t gap_amount;
      int32_t section_page_amount;
      int32_t x20;
      int32_t x80;
      int32_t x40;
      int32_t section_page_map_id;
      int64_t section_page_map_address;
      int32_t section_map_id;
      int32_t section_page_array_size;
      int32_t gap_array_size;
      int32_t CRC32;
    } fields;
  } _2004_header_data;


then It throws segfault.
Otherwise, It is working fine.

So whether is a problem associated with specifications or something else?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]