summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-22 10:40:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-22 10:40:07 +0100
commitac1ff3cb840d66b317d28a29d44d76813987a098 (patch)
tree62aeab5ad512763e2b828f641da6e7f5c75d228b
parent02effc8ef62ba30fc6bd8a57281105e3aecc29ce (diff)
crashtesting+ubsan: abi2079-1.html memcpy null source with 0 len
Change-Id: I50b9df6a428bd2ddb57819a9da6f07df346e7e61
-rw-r--r--vcl/source/fontsubset/ttcr.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index 0f24e25ae417..a916c2d445bd 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -797,7 +797,9 @@ static int GetRawData_name(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le
PutUInt16(nr[i].nameID, p1, 6, 1);
PutUInt16(nr[i].slen, p1, 8, 1);
PutUInt16((sal_uInt16)(p2 - (name + 6 + 12 * n)), p1, 10, 1);
- memcpy(p2, nr[i].sptr, nr[i].slen);
+ if (nr[i].slen) {
+ memcpy(p2, nr[i].sptr, nr[i].slen);
+ }
/* {int j; for(j=0; j<nr[i].slen; j++) printf("%c", nr[i].sptr[j]); printf("\n"); }; */
p2 += nr[i].slen;
p1 += 12;