summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_graphics_2d.cc
diff options
context:
space:
mode:
authorraphael.kubo.da.costa@intel.com <raphael.kubo.da.costa@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-18 12:07:24 +0000
committerraphael.kubo.da.costa@intel.com <raphael.kubo.da.costa@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-18 12:07:24 +0000
commitb6a59b4d43be201838e2fbbf213b4871ee10577a (patch)
tree1ddcb610f1483ae547c03d7bfb3aafc31a638a10 /ppapi/tests/test_graphics_2d.cc
parent1a4c137cb2a7125b27a6058026409607eef0ba8c (diff)
downloadchromium_src-b6a59b4d43be201838e2fbbf213b4871ee10577a.zip
chromium_src-b6a59b4d43be201838e2fbbf213b4871ee10577a.tar.gz
chromium_src-b6a59b4d43be201838e2fbbf213b4871ee10577a.tar.bz2
Verify that the image is not empty before calling memset().
Building with _FORTIFY_SOURCE=2 and NDEBUG set makes glibc complain that the call to memset() in TestGraphics2D::TestInitToZero() can have a 0-byte size argument. Avoid the warning by asserting that the image does have a valid area before using its height in the call to memset(). R=brettw, yzshen BUG= Review URL: https://chromiumcodereview.appspot.com/14087009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194893 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_graphics_2d.cc')
-rw-r--r--ppapi/tests/test_graphics_2d.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/ppapi/tests/test_graphics_2d.cc b/ppapi/tests/test_graphics_2d.cc
index 7377736..23a4fe7 100644
--- a/ppapi/tests/test_graphics_2d.cc
+++ b/ppapi/tests/test_graphics_2d.cc
@@ -321,6 +321,7 @@ std::string TestGraphics2D::TestInitToZero() {
pp::ImageData image(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
pp::Size(w, h), true);
ASSERT_FALSE(image.is_null());
+ ASSERT_FALSE(image.size().IsEmpty());
memset(image.data(), 0xFF, image.stride() * image.size().height() * 4);
// Read out the initial data from the device & check.