From ddcafcbd62c4efdc70bc626ab210a3c41dd1333c Mon Sep 17 00:00:00 2001 From: Konstantin Lopyrev Date: Fri, 4 Jun 2010 14:36:49 -0700 Subject: [PATCH] Fix 1684100: Making sure that empty package, type and resource ids are not accepted. Change-Id: I4c94877e4312e9a5b4d22c8625069ca056c62e40 --- libs/utils/ResourceTypes.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp index a1401addf3454..b5355cd76ed8d 100644 --- a/libs/utils/ResourceTypes.cpp +++ b/libs/utils/ResourceTypes.cpp @@ -2609,6 +2609,24 @@ bool ResTable::expandResourceRef(const uint16_t* refStr, size_t refLen, *outType = *defType; } *outName = String16(p, end-p); + if(**outPackage == 0) { + if(outErrorMsg) { + *outErrorMsg = "Resource package cannot be an empty string"; + } + return false; + } + if(**outType == 0) { + if(outErrorMsg) { + *outErrorMsg = "Resource type cannot be an empty string"; + } + return false; + } + if(**outName == 0) { + if(outErrorMsg) { + *outErrorMsg = "Resource id cannot be an empty string"; + } + return false; + } return true; }