diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-10-11 16:36:19 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-10-12 15:18:07 +0200 |
commit | b5c4bee884e9c4a5f988d21cec22abd9ddd0edcf (patch) | |
tree | a8cb1e93a0da15915480862031a683aef9dce6f1 /source/fitz | |
parent | 992c7c6cf15813760f4582682f5a48daba5d4239 (diff) | |
download | mupdf-b5c4bee884e9c4a5f988d21cec22abd9ddd0edcf.tar.xz |
Fix bug in murun when creating buffers from strings.
The code only worked for string literals, not garbage collected or
short strings.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/buffer.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/fitz/buffer.c b/source/fitz/buffer.c index a43ff296..7068803a 100644 --- a/source/fitz/buffer.c +++ b/source/fitz/buffer.c @@ -68,6 +68,15 @@ fz_new_buffer_from_shared_data(fz_context *ctx, const unsigned char *data, size_ } fz_buffer * +fz_new_buffer_from_copied_data(fz_context *ctx, const unsigned char *data, size_t size) +{ + fz_buffer *b = fz_new_buffer(ctx, size); + b->len = size; + memcpy(b->data, data, size); + return b; +} + +fz_buffer * fz_new_buffer_from_base64(fz_context *ctx, const char *data, size_t size) { fz_buffer *buf = fz_new_buffer(ctx, size); |