Mercurial > repos > blastem
comparison blastem.c @ 1788:154c7b348cf1
Fix off-by-one error in code for loading an SMD format ROM from a ZIP archive
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 19 Mar 2019 09:27:30 -0700 |
parents | d6d4c006a7b3 |
children | 8aeac7bd9fa7 |
comparison
equal
deleted
inserted
replaced
1786:2b661c1e431f | 1788:154c7b348cf1 |
---|---|
152 size_t out_size = nearest_pow2(z->entries[i].size); | 152 size_t out_size = nearest_pow2(z->entries[i].size); |
153 *dst = zip_read(z, i, &out_size); | 153 *dst = zip_read(z, i, &out_size); |
154 if (*dst) { | 154 if (*dst) { |
155 if (is_smd_format(z->entries[i].name, *dst)) { | 155 if (is_smd_format(z->entries[i].name, *dst)) { |
156 size_t offset; | 156 size_t offset; |
157 for (offset = 0; offset + SMD_BLOCK_SIZE + SMD_HEADER_SIZE < out_size; offset += SMD_BLOCK_SIZE) | 157 for (offset = 0; offset + SMD_BLOCK_SIZE + SMD_HEADER_SIZE <= out_size; offset += SMD_BLOCK_SIZE) |
158 { | 158 { |
159 uint8_t tmp[SMD_BLOCK_SIZE]; | 159 uint8_t tmp[SMD_BLOCK_SIZE]; |
160 memcpy(tmp, *dst + offset + SMD_HEADER_SIZE, SMD_BLOCK_SIZE); | 160 memcpy(tmp, *dst + offset + SMD_HEADER_SIZE, SMD_BLOCK_SIZE); |
161 process_smd_block(*dst + offset, tmp, SMD_BLOCK_SIZE); | 161 process_smd_block(*dst + offset, tmp, SMD_BLOCK_SIZE); |
162 } | 162 } |