DynamoRIO / DynamoRIO/drmemory

CryptProtectData result is marked uininitialized

Open
#512 2 comments 0 reactions 0 assignees View on GitHub
Bug-FalsePositive Migrated OpSys-Windows Priority-Low
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

_From [timurrrr@google.com](https://code.google.com/u/timurrrr@google.com/) on July 27, 2011 10:04:48_
#

#include
#include
#pragma comment(lib, "crypt32.lib")

#include

int main() {
DATA_BLOB input;
std::string message = "0123456789ABCDEF"; // must be at least 16 chars in length to force the string growth.
input.pbData = (BYTE*)message.data();
input.cbData = (DWORD)message.length();

DATA_BLOB output;
BOOL result = CryptProtectData(&input, L"", NULL, NULL, NULL, 0, &output);

std::string encrypted;
encrypted.assign((char*)output.pbData, output.cbData);
return 0;
}
#

Reports on XP 32-bits:
Error `#1`: UNINITIALIZED READ: reading 0x0012ff08-0x0012ff0c 4 byte(s)
@0:00:01.922 in thread 3060
0x00401661 test.exe!std::basic_string,std::allocator >::_Grow
c:\program files\microsoft visual studio 9.0\vc\include\xstring:2120
0x004013b8 test.exe!std::basic_string,std::allocator >::assign
c:\program files\microsoft visual studio 9.0\vc\include\xstring:1074
0x00401209 test.exe!main
test.cpp:17

Error `#2`: UNINITIALIZED READ: reading register esi
@0:00:01.938 in thread 3060
0x00402cbc test.exe!memcpy_s
f:\dd\vctools\crt_bld\self_x86\crt\src\memcpy_s.c:48
0x00401e68 test.exe!std::char_traits::_Copy_s
c:\program files\microsoft visual studio 9.0\vc\include\iosfwd:465
0x00401e38 test.exe!std::_Traits_helper::copy_sstd::char_traits
c:\program files\microsoft visual studio 9.0\vc\include\iosfwd:597
0x00401c86 test.exe!std::_Traits_helper::copy_sstd::char_traits
c:\program files\microsoft visual studio 9.0\vc\include\iosfwd:589
0x004013dc test.exe!std::basic_string,std::allocator >::assign
c:\program files\microsoft visual studio 9.0\vc\include\xstring:1076
0x00401209 test.exe!main
test.cpp:17

Error `#3`: UNINITIALIZED READ: reading register eax
@0:00:01.938 in thread 3060
0x0040163b test.exe!std::char_traits::assign
c:\program files\microsoft visual studio 9.0\vc\include\iosfwd:425
0x0040160b test.exe!std::basic_string,std::allocator >::_Eos
c:\program files\microsoft visual studio 9.0\vc\include\xstring:2114
0x004013eb test.exe!std::basic_string,std::allocator >::assign
c:\program files\microsoft visual studio 9.0\vc\include\xstring:1077
0x00401209 test.exe!main
test.cpp:17

_Original issue: http://code.google.com/p/drmemory/issues/detail?id=512_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.