summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2019-04-03 12:56:22 -0700
committerJosh Gao <jmgao@google.com>2019-04-10 11:13:35 -0700
commita7f6cd04700df65c9f1a6865c984b277020560e1 (patch)
tree135150b7a22851f43ef41c0fda10af6560dede3e /adb
parentac3ca99b77c4944333649dda4670d509f9facc05 (diff)
downloadsystem_core-a7f6cd04700df65c9f1a6865c984b277020560e1.tar.gz
system_core-a7f6cd04700df65c9f1a6865c984b277020560e1.tar.bz2
system_core-a7f6cd04700df65c9f1a6865c984b277020560e1.zip
adb: defuse CHECK on IOVector::append of an empty block.
Bug: http://b/129706741 Test: treehugger Change-Id: I35a35d20d179a155adb4fe83078739fcaf517136 (cherry picked from commit 3443b774155abb2e1d8583b11a8fc87ffa64c1ef)
Diffstat (limited to 'adb')
-rw-r--r--adb/types.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/adb/types.h b/adb/types.h
index 0090c9878..cd1366dfb 100644
--- a/adb/types.h
+++ b/adb/types.h
@@ -216,7 +216,10 @@ struct IOVector {
// Add a nonempty block to the chain.
// The end of the chain must be a complete block (i.e. end_offset_ == 0).
void append(std::unique_ptr<const block_type> block) {
- CHECK_NE(0ULL, block->size());
+ if (block->size() == 0) {
+ return;
+ }
+
CHECK_EQ(0ULL, end_offset_);
chain_length_ += block->size();
chain_.emplace_back(std::move(block));