summaryrefslogtreecommitdiff
path: root/ndisasm.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-11-20 13:22:58 -0800
committerH. Peter Anvin <hpa@zytor.com>2007-11-20 13:22:58 -0800
commit49da46883087678aedaa7a9703fdbb617b784fc6 (patch)
treed58727d12bdb7b56d027ec2588363db82c5357ee /ndisasm.c
parent2a15e69ebe0c99a1997952e63c6702c05aa93db0 (diff)
downloadnasm-49da46883087678aedaa7a9703fdbb617b784fc6.tar.gz
nasm-49da46883087678aedaa7a9703fdbb617b784fc6.tar.bz2
nasm-49da46883087678aedaa7a9703fdbb617b784fc6.zip
ndisasm: handle the case of "no more sync points"
Handle the case of "no more sync points" explicitly, instead of saying the next sync point is at UINT32_MAX.
Diffstat (limited to 'ndisasm.c')
-rw-r--r--ndisasm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ndisasm.c b/ndisasm.c
index 7949118..479bfe4 100644
--- a/ndisasm.c
+++ b/ndisasm.c
@@ -259,7 +259,7 @@ int main(int argc, char **argv)
nextsync = next_sync(offset, &synclen);
do {
uint32_t to_read = buffer + sizeof(buffer) - p;
- if (to_read > nextsync - offset - (p - q))
+ if (nextsync && to_read > nextsync - offset - (p - q))
to_read = nextsync - offset - (p - q);
if (to_read) {
lenread = fread(p, 1, to_read, fp);
@@ -268,7 +268,7 @@ int main(int argc, char **argv)
} else
lenread = 0;
p += lenread;
- if ((uint32_t)offset == nextsync) {
+ if (nextsync && (uint32_t)offset == nextsync) {
if (synclen) {
fprintf(stdout, "%08"PRIX32" skipping 0x%"PRIX32" bytes\n", offset, synclen);
offset += synclen;