diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-29 20:06:18 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-29 20:06:18 +0000 |
commit | fdce4788af32cb9af8d77361cfddb96249263437 (patch) | |
tree | 30c6e4b04a7f46658a57a1265729e0b5ebd2de10 /chrome/browser/mac | |
parent | 7d1025eeb76f1fe0e7bfe19f9f23b64974a63820 (diff) | |
download | chromium_src-fdce4788af32cb9af8d77361cfddb96249263437.zip chromium_src-fdce4788af32cb9af8d77361cfddb96249263437.tar.gz chromium_src-fdce4788af32cb9af8d77361cfddb96249263437.tar.bz2 |
ake string_util::WriteInto() DCHECK() that the supplied |length_with_null| > 1, meaning that the without-'\0' string is non-empty. This replaces the conditional code added recently that makes this case return NULL. It's easier to understand if it's simply an error to call WriteInto() in this case at all.
Add DCHECK()s or conditionals as appropriate to callers in order to ensure this assertion holds.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8418034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/mac')
-rw-r--r-- | chrome/browser/mac/install_from_dmg.mm | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/chrome/browser/mac/install_from_dmg.mm b/chrome/browser/mac/install_from_dmg.mm index b263491..6f276b8 100644 --- a/chrome/browser/mac/install_from_dmg.mm +++ b/chrome/browser/mac/install_from_dmg.mm @@ -141,6 +141,10 @@ bool MediaResidesOnDiskImage(io_service_t media, std::string* image_path) { CFDataRef image_path_data = static_cast<CFDataRef>( image_path_cftyperef.get()); CFIndex length = CFDataGetLength(image_path_data); + if (length <= 0) { + LOG(ERROR) << "image_path_data is unexpectedly empty"; + return true; + } char* image_path_c = WriteInto(image_path, length + 1); CFDataGetBytes(image_path_data, CFRangeMake(0, length), |