aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-12-25 00:56:01 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-12-25 01:56:42 +0100
commit29062e6c441f1bf34a9105b775cbde8955646388 (patch)
tree74b17a4681cfbd4b569dff50c80da870f0a0a648
parent624303d70d1e2593559f72a7b008244f9e62c5ca (diff)
downloadbfc-29062e6c441f1bf34a9105b775cbde8955646388.tar.gz
bfc-29062e6c441f1bf34a9105b775cbde8955646388.tar.xz
bfc-29062e6c441f1bf34a9105b775cbde8955646388.zip
Fix error handling
Offset overflowed.
-rw-r--r--bfc-amd64.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bfc-amd64.c b/bfc-amd64.c
index 9681ca1..9cb5b98 100644
--- a/bfc-amd64.c
+++ b/bfc-amd64.c
@@ -619,9 +619,9 @@ main (int argc, char *argv[])
CODE ("\x66\x5B") // pop bx
CODE ("\x48\x83\xF8\x00") // cmp rax, 0
- CODE ("\x48\x8D\x35") DD (4) // lea rsi, [rel read_message]
- CODE ("\x7C") // jl "fatal_offset" -- write failure message
- DB ((intptr_t) fatal_offset - (intptr_t) (buffer.len + 1))
+ CODE ("\x48\x8D\x35") DD (8) // lea rsi, [rel read_message]
+ CODE ("\x0F\x8C") // jl "fatal_offset" -- write failure message
+ DD ((intptr_t) fatal_offset - (intptr_t) (buffer.len + 4))
CODE ("\x58") // pop rax -- restore tape position
CODE ("\xC3") // ret
CODE ("fatal: read failed\n\0")
@@ -637,9 +637,9 @@ main (int argc, char *argv[])
CODE ("\x66\x5B") // pop bx
CODE ("\x48\x83\xF8\x00") // cmp rax, 0
- CODE ("\x48\x8D\x35") DD (4) // lea rsi, [rel write_message]
- CODE ("\x7C") // jl "fatal_offset" -- write failure message
- DB ((intptr_t) fatal_offset - (intptr_t) (buffer.len + 1))
+ CODE ("\x48\x8D\x35") DD (8) // lea rsi, [rel write_message]
+ CODE ("\x0F\x8C") // jl "fatal_offset" -- write failure message
+ DD ((intptr_t) fatal_offset - (intptr_t) (buffer.len + 4))
CODE ("\x58") // pop rax -- restore tape position
CODE ("\xC3") // ret
CODE ("fatal: write failed\n\0")