Fix svg memory issue 28/222228/1
authorRichard Huang <r.huang@samsung.com>
Fri, 10 Jan 2020 15:09:23 +0000 (15:09 +0000)
committerRichard Huang <r.huang@samsung.com>
Fri, 10 Jan 2020 15:09:27 +0000 (15:09 +0000)
- fix heap-buffer-overflow issue
- nsvgParse : Parses SVG file from a null terminated string

Change-Id: Ie462dd63b03ba212b5e67c89406fb477f83f0692

dali-toolkit/internal/visuals/svg/svg-visual.cpp

index a3d3685..fccd5e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -208,6 +208,7 @@ void SvgVisual::ParseFromUrl( const VisualUrl& imageUrl )
     Dali::Vector<char> buffer;
     if ( Dali::FileLoader::ReadFile( mImageUrl.GetUrl(), buffer ) )
     {
+      buffer.PushBack( '\0' );
       mParsedImage = nsvgParse( buffer.Begin(), UNITS, meanDpi );
     }
   }