From 39fce398ee51b8606deeaa079b0d49838b215037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 3 Mar 2012 12:20:08 +0100 Subject: [PATCH] Raised maximum vector data size from 16 KiB to 512 KiB. * The maximum vector icon data size was a bit low. That may be hard to track down why a certain vector icon doesn't work, especially when imported from SVG... * Don't allocate the vector buffer on the stack anymore. --- src/libs/icon/IconUtils.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libs/icon/IconUtils.cpp b/src/libs/icon/IconUtils.cpp index 229fe6bd02..b8293ad5f3 100644 --- a/src/libs/icon/IconUtils.cpp +++ b/src/libs/icon/IconUtils.cpp @@ -384,11 +384,17 @@ bigtime_t startTime = system_time(); return B_BAD_TYPE; // chicken out on unrealisticly large attributes - if (attrInfo.size > 16 * 1024) + if (attrInfo.size > 512 * 1024) return B_BAD_VALUE; - uint8 buffer[attrInfo.size]; - ssize_t read = node->ReadAttr(attrName, attrType, 0, buffer, attrInfo.size); + uint8* buffer = new(std::nothrow) uint8[attrInfo.size]; + if (buffer == NULL) + return B_NO_MEMORY; + + ArrayDeleter _(buffer); + + ssize_t read = node->ReadAttr(attrName, attrType, 0, buffer, + attrInfo.size); if (read != attrInfo.size) return B_ERROR;