Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
binwalk
Commits
a6ed41fb
Commit
a6ed41fb
authored
Nov 21, 2013
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed hexdiff offset bug; fixed potential additional bugs in BlockFile length/offset calculations.
parent
4ddad90a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletions
+24
-1
common.py
src/binwalk/common.py
+13
-1
hexdiff.py
src/binwalk/hexdiff.py
+11
-0
No files found.
src/binwalk/common.py
View file @
a6ed41fb
...
@@ -153,9 +153,21 @@ class BlockFile(io.FileIO):
...
@@ -153,9 +153,21 @@ class BlockFile(io.FileIO):
else
:
else
:
self
.
offset
=
offset
self
.
offset
=
offset
if
length
:
if
self
.
offset
<
0
:
self
.
offset
=
0
elif
self
.
offset
>
self
.
size
:
self
.
offset
=
self
.
size
if
offset
<
0
:
self
.
length
=
offset
*
-
1
elif
length
:
self
.
length
=
length
self
.
length
=
length
else
:
else
:
self
.
length
=
self
.
size
-
offset
if
self
.
length
<
0
:
self
.
length
=
0
elif
self
.
length
>
self
.
size
:
self
.
length
=
self
.
size
self
.
length
=
self
.
size
io
.
FileIO
.
__init__
(
self
,
fname
,
mode
)
io
.
FileIO
.
__init__
(
self
,
fname
,
mode
)
...
...
src/binwalk/hexdiff.py
View file @
a6ed41fb
...
@@ -101,6 +101,10 @@ class HexDiff(object):
...
@@ -101,6 +101,10 @@ class HexDiff(object):
data
=
{}
data
=
{}
delim
=
'/'
delim
=
'/'
# If negative offset, then we're going that far back from the end of the file
if
offset
<
0
:
size
=
offset
*
-
1
if
show_first_only
:
if
show_first_only
:
self
.
_header
([
files
[
0
]],
block
)
self
.
_header
([
files
[
0
]],
block
)
else
:
else
:
...
@@ -122,9 +126,16 @@ class HexDiff(object):
...
@@ -122,9 +126,16 @@ class HexDiff(object):
while
total
<
size
:
while
total
<
size
:
i
=
0
i
=
0
files_finished
=
0
for
fp
in
fps
:
for
fp
in
fps
:
(
ddata
,
dlen
)
=
fp
.
read_block
()
(
ddata
,
dlen
)
=
fp
.
read_block
()
data
[
fp
.
name
]
=
ddata
data
[
fp
.
name
]
=
ddata
if
not
ddata
or
dlen
==
0
:
files_finished
+=
1
if
files_finished
==
len
(
fps
):
break
while
i
<
read_block_size
and
(
total
+
i
)
<
size
:
while
i
<
read_block_size
and
(
total
+
i
)
<
size
:
diff_same
=
{}
diff_same
=
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment