[Libreoffice-commits] core.git: vcl/source

Caolán McNamara caolanm at redhat.com
Thu Oct 22 02:40:53 PDT 2015


 vcl/source/fontsubset/ttcr.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit ac1ff3cb840d66b317d28a29d44d76813987a098
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 22 10:40:07 2015 +0100

    crashtesting+ubsan: abi2079-1.html memcpy null source with 0 len
    
    Change-Id: I50b9df6a428bd2ddb57819a9da6f07df346e7e61

diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index 0f24e25..a916c2d 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;


More information about the Libreoffice-commits mailing list