Fixed crash if encryption buffer is null
authorSoyoung Kim <sy037.kim@samsung.com>
Tue, 23 Apr 2013 09:00:58 +0000 (18:00 +0900)
committerGerrit Code Review <gerrit2@kim11>
Tue, 23 Apr 2013 09:02:01 +0000 (18:02 +0900)
[Issue#] N/A
[Problem] there is a crash when encryption resource.
[Cause] no null check
[Solution] check null from get buffer from trustzone.
[SCMRequest] N/A

src/jobs/widget_install/task_encrypt_resource.cpp

index bca5665..647817e 100644 (file)
@@ -347,6 +347,10 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
             ByteBuffer *getBuffer = EncryptChunkByTrustZone(
                     &appInfo,
                     inChunk.get(), bytesRead);
+            if (getBuffer == NULL) {
+                ThrowMsg(Exceptions::EncryptionFailed,
+                        "Encryption Failed using TrustZone");
+            }
             int decBufSize = getBuffer->GetRemaining();
 
             outChunk.reset(new unsigned char[decBufSize]);