about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-05-14 21:07:22 -0700
committerKartik Agaram <vc@akkartik.com>2019-05-14 21:07:22 -0700
commit2f49a27504fe302c1df8e55f7a1b63571495182c (patch)
tree27797c0c8951cf0699974cfa45a70bb6a93c7d4d /subx
parent56a0f3c560b9763c1aafdf7898d134b57277ff5e (diff)
downloadmu-2f49a27504fe302c1df8e55f7a1b63571495182c.tar.gz
fix a stale register value in dquotes.subx
How did things seem to be working until now?
- We were saving an address from the stack to stream.read
- When we read this address in skip-chars-matching:loop, we used to stop early

But now we've moved the stack to a larger address, one where the most significant
byte is set. When the stack address now gets to skip-chars-matching:loop,
it's treated as a negative number and we proceed through the loop. At which
point we try to index into the array using it.

No real test to be written to protect against this :(
Diffstat (limited to 'subx')
-rwxr-xr-xsubx/apps/dquotesbin24275 -> 24277 bytes
-rw-r--r--subx/apps/dquotes.subx3
2 files changed, 2 insertions, 1 deletions
diff --git a/subx/apps/dquotes b/subx/apps/dquotes
index c180c114..c346647c 100755
--- a/subx/apps/dquotes
+++ b/subx/apps/dquotes
Binary files differdiff --git a/subx/apps/dquotes.subx b/subx/apps/dquotes.subx
index 5f98d295..2ca82a95 100644
--- a/subx/apps/dquotes.subx
+++ b/subx/apps/dquotes.subx
@@ -31,7 +31,7 @@ Entry:  # run tests if necessary, convert stdin if not
 #?     # . . discard args
 #?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
 #?     # . test()
-#?     e8/call test-emit-string-literal-data/disp32
+#?     e8/call  test-convert-is-idempotent-by-default/disp32
 #?     8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/EBX   Num-test-failures/disp32          # copy *Num-test-failures to EBX
 #?     eb/jump  $main:end/disp8
 
@@ -1503,6 +1503,7 @@ $next-word:comment:
     8d/copy-address                 1/mod/*+disp8   4/rm32/sib    6/base/ESI  0/index/EAX   .           0/r32/EAX   0xc/disp8       .                 # copy ESI+EAX+12 to EAX
     89/copy                         1/mod/*+disp8   7/rm32/EDI    .           .             .           0/r32/EAX   4/disp8         .                 # copy EAX to *(EDI+4)
     # line->read = line->write  # skip rest of line
+    8b/copy                         0/mod/indirect  6/rm32/ESI    .           .             .           0/r32/EAX   .               .                 # copy *ESI to EAX
     89/copy                         1/mod/*+disp8   6/rm32/ESI    .           .             .           0/r32/EAX   4/disp8         .                 # copy EAX to *(ESI+4)
     # return
     eb/jump  $next-word:end/disp8