Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: third_party/WebKit/Source/wtf/BitArray.h

Issue 1672603002: Change assert to release assert for BitArray to prevent out-of-bounds access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 25 matching lines...) Expand all
36 class BitArray { 36 class BitArray {
37 USING_FAST_MALLOC(BitArray); 37 USING_FAST_MALLOC(BitArray);
38 public: 38 public:
39 BitArray(bool value = false) 39 BitArray(bool value = false)
40 { 40 {
41 memset(m_data, value ? 0xFF : 0, sizeof(m_data)); 41 memset(m_data, value ? 0xFF : 0, sizeof(m_data));
42 } 42 }
43 43
44 void set(unsigned index) 44 void set(unsigned index)
45 { 45 {
46 ASSERT_WITH_SECURITY_IMPLICATION(index < arraySize); 46 RELEASE_ASSERT(index < arraySize);
47 m_data[index / 8] |= 1 << (index & 7); 47 m_data[index / 8] |= 1 << (index & 7);
48 } 48 }
49 49
50 void clear(unsigned index) 50 void clear(unsigned index)
51 { 51 {
52 ASSERT_WITH_SECURITY_IMPLICATION(index < arraySize); 52 RELEASE_ASSERT(index < arraySize);
53 m_data[index / 8] &= ~(1 << (index & 7)); 53 m_data[index / 8] &= ~(1 << (index & 7));
54 } 54 }
55 55
56 bool get(unsigned index) const 56 bool get(unsigned index) const
57 { 57 {
58 ASSERT_WITH_SECURITY_IMPLICATION(index < arraySize); 58 RELEASE_ASSERT(index < arraySize);
59 return !!(m_data[index / 8] & (1 << (index & 7))); 59 return !!(m_data[index / 8] & (1 << (index & 7)));
60 } 60 }
61 61
62 private: 62 private:
63 unsigned char m_data[arraySize / 8 + 1]; 63 unsigned char m_data[arraySize / 8 + 1];
64 }; 64 };
65 65
66 } // namespace WTF 66 } // namespace WTF
67 67
68 using WTF::BitArray; 68 using WTF::BitArray;
69 69
70 #endif // BitArray_h 70 #endif // BitArray_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698