summaryrefslogtreecommitdiff
path: root/nasmlib
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-04-24 11:14:43 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-04-24 11:14:43 -0700
commit9bb55bd1276822565f111f0bb347024b7e08df5b (patch)
tree4582a8ab5ea1dbbe5fc60484fc9518a426b29797 /nasmlib
parent982186a1a3139763f2aa2710b32236009f64270d (diff)
parent8b262474424c0f6912b22bbf7452f26bfa4d1235 (diff)
downloadnasm-9bb55bd1276822565f111f0bb347024b7e08df5b.tar.gz
Merge branch 'evalmacro'
Resolved Conflicts: asm/preproc.c output/elf.h output/outelf.c output/outelf.h version Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'nasmlib')
-rw-r--r--nasmlib/saa.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/nasmlib/saa.c b/nasmlib/saa.c
index fe7741a4..dcc2c019 100644
--- a/nasmlib/saa.c
+++ b/nasmlib/saa.c
@@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 1996-2017 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
@@ -14,7 +14,7 @@
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
@@ -262,9 +262,12 @@ void saa_fread(struct SAA *s, size_t posn, void *data, size_t len)
void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len)
{
size_t ix;
+ size_t padding = 0;
- /* Seek beyond the end of the existing array not supported */
- nasm_assert(posn <= s->datalen);
+ if (posn > s->datalen) {
+ padding = posn - s->datalen;
+ posn = s->datalen;
+ }
if (likely(s->blk_len == SAA_BLKLEN)) {
ix = posn >> SAA_BLKSHIFT;
@@ -281,6 +284,9 @@ void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len)
s->wblk--;
}
+ if (padding)
+ saa_wbytes(s, NULL, padding);
+
saa_wbytes(s, data, len);
}