Skip to content

Commit

Permalink
Merge "protozero: DCHECK against zero field ids" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
skyostil authored and Gerrit Code Review committed Sep 13, 2023
2 parents 7a0e197 + 2fa2728 commit cdfcc0a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/protozero/message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void Message::AppendString(uint32_t field_id, const char* str) {
}

void Message::AppendBytes(uint32_t field_id, const void* src, size_t size) {
PERFETTO_DCHECK(field_id);
if (nested_message_)
EndNestedMessage();

Expand All @@ -90,6 +91,7 @@ void Message::AppendBytes(uint32_t field_id, const void* src, size_t size) {
size_t Message::AppendScatteredBytes(uint32_t field_id,
ContiguousMemoryRange* ranges,
size_t num_ranges) {
PERFETTO_DCHECK(field_id);
if (nested_message_)
EndNestedMessage();

Expand Down Expand Up @@ -143,6 +145,7 @@ uint32_t Message::Finalize() {
}

Message* Message::BeginNestedMessageInternal(uint32_t field_id) {
PERFETTO_DCHECK(field_id);
if (nested_message_)
EndNestedMessage();

Expand Down

0 comments on commit cdfcc0a

Please sign in to comment.