summaryrefslogtreecommitdiffstats
path: root/chrome/common/sqlite_utils.cc
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 04:57:24 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 04:57:24 +0000
commitb2cd48a762ba7b5348a2566d96866a0ff2422895 (patch)
tree45512b1cfeae38b8b6d02a1c6bf4dc9755f09474 /chrome/common/sqlite_utils.cc
parent4ee0c53f86c1b2e0da904018c6bc0c8fdcda28a4 (diff)
downloadchromium_src-b2cd48a762ba7b5348a2566d96866a0ff2422895.zip
chromium_src-b2cd48a762ba7b5348a2566d96866a0ff2422895.tar.gz
chromium_src-b2cd48a762ba7b5348a2566d96866a0ff2422895.tar.bz2
sqlite_utils: don't dereference an empty vector.
user_settings: Add unit test intended to exercise the above path. In practice though these tests don't hit the bug, since EncryptData("") results in non-empty ciphertext. bonus: don't leak a sqlite handle in one of the other sync unit tests. TEST=none BUG=40217 Review URL: http://codereview.chromium.org/2801017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/sqlite_utils.cc')
-rw-r--r--chrome/common/sqlite_utils.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/chrome/common/sqlite_utils.cc b/chrome/common/sqlite_utils.cc
index 8e108a7..b99b8f2 100644
--- a/chrome/common/sqlite_utils.cc
+++ b/chrome/common/sqlite_utils.cc
@@ -323,7 +323,7 @@ int SQLStatement::bind_parameter_count() {
int SQLStatement::bind_blob(int index, std::vector<unsigned char>* blob) {
if (blob) {
- const void* value = &(*blob)[0];
+ const void* value = blob->empty() ? NULL : &(*blob)[0];
int len = static_cast<int>(blob->size());
return bind_blob(index, value, len);
} else {