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

Unified Diff: net/tools/transport_security_state_generator/trie/trie_bit_buffer.cc

Issue 2681733008: Improve error handling of the transport security state generator. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: net/tools/transport_security_state_generator/trie/trie_bit_buffer.cc
diff --git a/net/tools/transport_security_state_generator/trie/trie_bit_buffer.cc b/net/tools/transport_security_state_generator/trie/trie_bit_buffer.cc
index 5add4ead22c9fb2ba3fe3512674c17dcc494e519..e9e8f4b9a684e0d9599930e2db2dc4650d3cd7b4 100644
--- a/net/tools/transport_security_state_generator/trie/trie_bit_buffer.cc
+++ b/net/tools/transport_security_state_generator/trie/trie_bit_buffer.cc
@@ -71,16 +71,19 @@ uint8_t TrieBitBuffer::BitLength(uint32_t input) const {
return number_of_bits;
}
-void TrieBitBuffer::WriteChar(uint8_t byte,
+bool TrieBitBuffer::WriteChar(uint8_t byte,
const HuffmanRepresentationTable& table,
HuffmanBuilder* huffman_builder) {
HuffmanRepresentationTable::const_iterator item;
item = table.find(byte);
- DCHECK(item != table.end());
+ if (item == table.end()) {
+ return false;
+ }
Ryan Sleevi 2017/02/14 20:53:17 Why the change from DCHECK to being a soft-check?
martijnc 2017/02/15 22:07:59 Not crashing on incorrect inputs. But looking at t
if (huffman_builder) {
huffman_builder->RecordUsage(byte);
}
WriteBits(item->second.bits, item->second.number_of_bits);
+ return true;
}
void TrieBitBuffer::AppendBitsElement(uint8_t bits, uint8_t number_of_bits) {

Powered by Google App Engine
This is Rietveld 408576698