From f3d0bfd37415813e9c73bff9701f672a986fe407 Mon Sep 17 00:00:00 2001 From: xjd Date: Tue, 9 Apr 2024 15:23:01 +0800 Subject: [PATCH] Fix offset error --- script/src/scheduler.rs | 3 --- script/testdata/spawn_fuzzing | Bin 5904 -> 5936 bytes script/testdata/spawn_fuzzing.c | 3 +++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/script/src/scheduler.rs b/script/src/scheduler.rs index a00e01ce23..8f50dfe7e9 100644 --- a/script/src/scheduler.rs +++ b/script/src/scheduler.rs @@ -493,9 +493,6 @@ where .store64(&length_addr, &actual_length)?; machine.machine.set_register(A0, SUCCESS as u64); } else { - // TODO: in the previous convention - // https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0009-vm-syscalls/0009-vm-syscalls.md#partial-loading - // this will load data in to address 0 without notice. It is now marked as an error. machine.machine.set_register(A0, INDEX_OUT_OF_BOUND as u64); } continue; diff --git a/script/testdata/spawn_fuzzing b/script/testdata/spawn_fuzzing index fd7c2dffb2c7471c9d2f63c5007d95bcb281080e..0c1602e09a0d72fcdac435e08127a92063f085e8 100755 GIT binary patch delta 978 zcmZ9LZAep57{|}KyZ3I_`7(EOqoihrnPHlQND)rTx%?6$WmH7!CZ-coo0Nf=x}(m* z90&7@k**RAieiKWmJvpI&ghhb!M=r(E( zgvQqmGlnDpvwh;V7ewLV&eN{y%0Sh$m;V&^vDZJkjLl<<W&{u;oR%1t1123C z#fZ!zv&{Ip!v>gTvMIv@6hiFmFGL|nI!UW7fUdFumyiIYh=k7XobGgmB!InFX{^-_ zcK6{cf^okm!`~(!C0oK`P9L z^F#Tw_9!mWIPMn2;W=xFIlHE}hQBmdmTl>^@Z~v$4VP!UmX)9yHs;|B&!ZvEXzG|} zg9>&)M#Huq38Ev1+{K1sXA|NJWCUX+;;`ToS0+yk2u4%eJdm=1e8g9<8(H1Nje+S4 zCtHf2R9Cu7dg*^?4kfwaZH)dM@rEC&Qy^@k5dA9&`-~@?eJ!FJbxTq-i}+kl0{Xl|FqFE@&L%D5+hrS~Q_t@W zNziWcI3g`cKkTfC!;IBHrPe3Ul`!j*4{qdd#i}68B-f zJy#7HfUupUMyCjws-RXTDUD7S{=78OAFY>=)J~E_jh<0Nk}^#O>?8dez0eaCJVy>m H)#!c$T)kP% delta 954 zcmZ8gUr19?7(eHF@7?aSHg|Gjf-XZ;2(>H*A!G4VknV+k(QOvNJ5{%B?DgRvV3?qO!3)TPKh%cOy&IghZT+EnH{nAoxx_S zVF1{c{h|f;MIlT6N*m$Nv@pDt$8xt-Qcwa>>8y;W8DL7F)s#qWQUNMxYUfl9W}yOc z^l#KEqw~A5qInxd(%V^F3Xl*?qNsbZdsvYIvN{N+umfg5=-~L%b2-5WGFP{7qs?SB zK%>@L3yD-I@DB;wFWL!oe8<5;au5?p4ZnXO-~G*-E)*qhunTcfYsQ0{C&Y-R)&1P(ER z%rBOF8S`?ysdEiT)$Jn0=F;J+f@u_<%-q)8#43)kzsk190tgiPx^-5SZUQ(Vq(L3QJ zUx6|k{<*o94QrNo!*yw60qD4Uy1gUoTtu!Zd|WUOq&nwHE@td6`+87 zZ_#&|B=wO{0|<}s}lj-*ouhXa1R=RunHH%WN=zl v$V-duF*@$=AB87l^pd1T4`1Lsjhnj{YwXcGSbT9-<= diff --git a/script/testdata/spawn_fuzzing.c b/script/testdata/spawn_fuzzing.c index 280286eb0f..7702717c0a 100644 --- a/script/testdata/spawn_fuzzing.c +++ b/script/testdata/spawn_fuzzing.c @@ -24,6 +24,7 @@ int extract_command(Data* data, Command* cmd) { if (id > 250) { cmd->id = SyscallClose; cmd->fd_index = (size_t)(id % 2); + data->offset += 1; } else if (id > 128) { if ((data->offset + 7) > data->total_size) { return -1; @@ -31,6 +32,7 @@ int extract_command(Data* data, Command* cmd) { cmd->id = SyscallRead; memcpy(&cmd->buf_ptr, &data->ptr[data->offset + 1], 3); memcpy(&cmd->len_ptr, &data->ptr[data->offset + 4], 3); + data->offset += 7; } else { if ((data->offset + 7) > data->total_size) { return -1; @@ -38,6 +40,7 @@ int extract_command(Data* data, Command* cmd) { cmd->id = SyscallWrite; memcpy(&cmd->buf_ptr, &data->ptr[data->offset + 1], 3); memcpy(&cmd->len_ptr, &data->ptr[data->offset + 4], 3); + data->offset += 7; } return 0; }