Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Complex block length
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Greg  
View profile  
 More options Oct 26, 7:29 pm
From: Greg <gfo...@gmail.com>
Date: Mon, 26 Oct 2009 16:29:12 -0700 (PDT)
Local: Mon, Oct 26 2009 7:29 pm
Subject: Complex block length
I'm trying to fuzz a proprietary container file format. Part of this
format includes a table of offsets to 'records' within the file. For
the purposes of my test, I'd like to treat each record (other than the
first) as essentially an opaque blob.

The problem I'm facing is that the length of each record is not
explicitly recorded in the file format. To calculate the length of a
given record, you must subtract the record's offset from the
subsequent record's offset, or the total length of the file if it is
the last record.

Here's what I intially wrote;

   <Block name="Header">
      <Number name="numberOfRecords" size="16" signed="false"
endian="big">
        <Relation type="count" of="OtherRecordInfos"
expressionGet="count-1" expressionSet="count+1"/>
      </Number>
      <Block name="MasterRecord" ref="RecordInfo">
        <Number name="fileOffset" size="32" signed="false"
endian="big">
          <Relation type="offset" of="MasterHeaderRecord"/>
        </Number>
      </Block>
      <Block name="OtherRecordInfos" ref="PDBRecordInfo"
minOccurs="0">
        <Number name="fileOffset" size="32" signed="false"
endian="big">
          <Relation type="offset" of="SomeRecord"/>
        </Number>
        <Block name="SomeRecord">
          <Placement after="MasterHeaderRecord"/>
          <Blob/>
        </Block>
      </Block>
    </Block>
    <Block name="MasterHeaderRecord" ref="MasterPDBRecordModel">
    </Block>

This sent peach into an infinite loop. The only way I know to work
around this issue is to hardcode a guessed length of each record.

Thoughts?

-greg


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Eddington  
View profile  
 More options Oct 27, 11:18 am
From: Michael Eddington <medding...@gmail.com>
Date: Tue, 27 Oct 2009 08:18:17 -0700
Local: Tues, Oct 27 2009 11:18 am
Subject: RE: [Peach] Complex block length
So your doing to need a length on that blob.  You can say lengthtype=calc and then put some pythone code into length that will be used to determin its size.  The blob will have a variable called possiblePos or pos with the current offset.  The only part i'm not sure about is finding the next offset to calc ur length from.

There are some other possible solutions.  I'll think about it and get back later today.  (custome types, an analyzer, python tricckery, etc).

mike


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Foltz  
View profile  
 More options Oct 27, 8:27 pm
From: Greg Foltz <gfo...@gmail.com>
Date: Tue, 27 Oct 2009 17:27:51 -0700
Local: Tues, Oct 27 2009 8:27 pm
Subject: Re: [Peach] Re: Complex block length

Thanks for your thoughts!

I considered the lengthtype=calc solution and soon ran into the problem you
mention; how do you get the offset for the next record? From my reading of
the peach code, that piece of the input has yet to be 'cracked' at the
moment that getLength is called. And I was unable to determine a way to
access the input stream directly.

-greg

On Tue, Oct 27, 2009 at 8:18 AM, Michael Eddington <medding...@gmail.com>wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Eddington  
View profile  
 More options Oct 27, 9:07 pm
From: Michael Eddington <medding...@gmail.com>
Date: Tue, 27 Oct 2009 18:07:52 -0700
Local: Tues, Oct 27 2009 9:07 pm
Subject: Re: [Peach] Re: Complex block length

Yup, I think what I would do is write some helper python code that I
load into the pit file using Import that has a method that can calc my
length.  It would do the following:

1. Take in the name of the offset array
2. Locate the current end of array, grab the numbers position and read
next next N bytes, unpack and then do the required math.
3. Return value

then your length="my_calcLengthHack('xyz')"

mike

On 10/27/2009 5:27 PM, Greg Foltz wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Foltz  
View profile  
 More options Nov 14, 10:25 am
From: Greg Foltz <gfo...@gmail.com>
Date: Sat, 14 Nov 2009 07:25:44 -0800
Local: Sat, Nov 14 2009 10:25 am
Subject: Re: [Peach] Re: Complex block length

Thanks for all your help on this, Mike! Great to have you so active in this
group.

I've tried to do this, but it's not clear how the helper function gets
access to the input data. (The 'buff' value used in incoming.py). Is this
exposed as a global variable somehow?

-greg

On Tue, Oct 27, 2009 at 5:07 PM, Michael Eddington <medding...@gmail.com>wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google