mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-28 06:04:24 +01:00
In NonAllocatingMap, remove asserts around key/value length.
Since the data is stored using strncpy they are merely advisory in debug mode. BUG=https://code.google.com/p/chromium/issues/detail?id=298225 R=mark@chromium.org Review URL: https://breakpad.appspot.com/635002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1219 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
b7acb2a56a
commit
0453082dbe
@ -181,8 +181,6 @@ class NonAllocatingMap {
|
|||||||
if (!entries_[i].is_active()) {
|
if (!entries_[i].is_active()) {
|
||||||
entry = &entries_[i];
|
entry = &entries_[i];
|
||||||
|
|
||||||
assert(strlen(key) < key_size);
|
|
||||||
|
|
||||||
strncpy(entry->key, key, key_size);
|
strncpy(entry->key, key, key_size);
|
||||||
entry->key[key_size - 1] = '\0';
|
entry->key[key_size - 1] = '\0';
|
||||||
|
|
||||||
@ -205,7 +203,6 @@ class NonAllocatingMap {
|
|||||||
assert(count == 1);
|
assert(count == 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert(strlen(value) < value_size);
|
|
||||||
strncpy(entry->value, value, value_size);
|
strncpy(entry->value, value, value_size);
|
||||||
entry->value[value_size - 1] = '\0';
|
entry->value[value_size - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -290,18 +290,6 @@ TEST(NonAllocatingMapTest, OutOfSpace) {
|
|||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|
||||||
TEST(NonAllocatingMapTest, KeyTooLong) {
|
|
||||||
NonAllocatingMap<3, 10, 12> map;
|
|
||||||
map.SetKeyValue("ab", "cdefghi");
|
|
||||||
ASSERT_DEATH(map.SetKeyValue("abcdef", "1"), "");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(NonAllocatingMapTest, ValueTooLong) {
|
|
||||||
NonAllocatingMap<9, 3, 8> map;
|
|
||||||
map.SetKeyValue("abcd", "ab");
|
|
||||||
ASSERT_DEATH(map.SetKeyValue("abcd", "abc"), "");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(NonAllocatingMapTest, NullKey) {
|
TEST(NonAllocatingMapTest, NullKey) {
|
||||||
NonAllocatingMap<4, 6, 6> map;
|
NonAllocatingMap<4, 6, 6> map;
|
||||||
ASSERT_DEATH(map.SetKeyValue(NULL, "hello"), "");
|
ASSERT_DEATH(map.SetKeyValue(NULL, "hello"), "");
|
||||||
|
Loading…
Reference in New Issue
Block a user