Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scapy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def hexdiff(
if dox:
xd = y
j = 0
while not linex[j]:
while j < len(linex) and not linex[j]:
j += 1
xd -= 1
print(colorize[doy - dox]("%04x" % xd), end=' ')
Expand All @@ -541,7 +541,7 @@ def hexdiff(
if doy:
yd = y
j = 0
while not liney[j]:
while j < len(liney) and not liney[j]:
j += 1
yd -= 1
print(colorize[doy - dox]("%04x" % yd), end=' ')
Expand Down
5 changes: 5 additions & 0 deletions test/regression.uts
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,11 @@ assert expected_ret2 in ret2
hexdiff(b"abc", IP() / TCP())
hexdiff(IP() / TCP(), b"abc")

# Test that hexdiff does not crash on a 16-byte row that is entirely a gap
# on one side (GH #5034)

hexdiff(b"B" * 9 + b"\x08", b"A" + b"\x08" + b"A" * 23, algo="difflib")

= Test mysummary functions - Ether

p = Ether(dst="ff:ff:ff:ff:ff:ff", src="ff:ff:ff:ff:ff:ff", type=0x9000)
Expand Down
Loading