aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-05-05 15:30:14 +0100
committergingerBill <bill@gingerbill.org>2022-05-05 15:30:14 +0100
commite61aad925b95de74c19d02528ba23023c78768b1 (patch)
tree2ed445bf8af2e1219fd6784df367d49bb823a613 /core
parent5d190b15d7a665ada76ad752e2b41b4e6456c075 (diff)
parentfe442d7c0c4767e5412094d47acc176aae3e2834 (diff)
Merge branch 'master' of https://github.com/odin-lang/Odin
Diffstat (limited to 'core')
-rw-r--r--core/crypto/sha2/sha2.odin6
-rw-r--r--core/mem/allocators.odin2
2 files changed, 6 insertions, 2 deletions
diff --git a/core/crypto/sha2/sha2.odin b/core/crypto/sha2/sha2.odin
index 7c7b2da81..9792a4cb8 100644
--- a/core/crypto/sha2/sha2.odin
+++ b/core/crypto/sha2/sha2.odin
@@ -419,8 +419,10 @@ update :: proc(ctx: ^$T, data: []byte) {
sha2_transf(ctx, shifted_message, block_nb)
rem_len = new_len % CURR_BLOCK_SIZE
- when T == Sha256_Context {copy(ctx.block[:], shifted_message[block_nb << 6:rem_len])}
- else when T == Sha512_Context {copy(ctx.block[:], shifted_message[block_nb << 7:rem_len])}
+ if rem_len > 0 {
+ when T == Sha256_Context {copy(ctx.block[:], shifted_message[block_nb << 6:rem_len])}
+ else when T == Sha512_Context {copy(ctx.block[:], shifted_message[block_nb << 7:rem_len])}
+ }
ctx.length = rem_len
when T == Sha256_Context {ctx.tot_len += (block_nb + 1) << 6}
diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin
index b8bd9a065..118a7f7e6 100644
--- a/core/mem/allocators.odin
+++ b/core/mem/allocators.odin
@@ -746,6 +746,8 @@ dynamic_pool_reset :: proc(using pool: ^Dynamic_Pool) {
free(a, block_allocator)
}
clear(&out_band_allocations)
+
+ bytes_left = 0 // Make new allocations call `cycle_new_block` again.
}
dynamic_pool_free_all :: proc(using pool: ^Dynamic_Pool) {