Skip to content

Commit 49ffde7

Browse files
committed
test(cpp): add sink-based protobuf model tests and trim comments
Replace the step-coverage function with one sink test per model row using a template source, declare the Cord overloads of the ToString methods in the stub, drop the incorrect istream comment from the fixture, and shorten the model-file and change-note comments per review.
1 parent d0b3dd5 commit 49ffde7

5 files changed

Lines changed: 874 additions & 175 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: minorAnalysis
33
---
4-
* Added flow summaries for the Protocol Buffers C++ API (`google::protobuf::MessageLite`, covering `Message` and all generated messages).
4+
* Added flow summaries for the Protocol Buffers `google::protobuf::MessageLite` C++ API.

cpp/ql/lib/ext/Protobuf.model.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,10 @@ extensions:
33
pack: codeql/cpp-all
44
extensible: summaryModel
55
data: # namespace, type, subtypes, name, signature, ext, input, output, kind, provenance
6-
# Flow summaries for the Protocol Buffers C++ API. All of these methods are declared on
7-
# `google::protobuf::MessageLite`; `subtypes` covers `Message` and every generated message.
8-
#
96
# File-descriptor variants (`{Parse,Serialize}*FromFileDescriptor`) are intentionally omitted:
107
# the descriptor is an `int`, not a data buffer, so there is no buffer argument to model.
118

12-
# Deserialization: the encoded input taints the message (`this`). The `*FromString` methods each
13-
# have a `string_view` overload (the buffer is the by-value argument, so `Argument[0]`) and a
14-
# `const Cord &` overload (the buffer is behind a reference, so `Argument[*0]`). The remaining
15-
# inputs below are pointers or references, so they take `Argument[*0]`.
9+
# Deserialization
1610
- ["google::protobuf", "MessageLite", True, "ParseFromString", "(string_view)", "", "Argument[0]", "Argument[-1]", "taint", "manual"]
1711
- ["google::protobuf", "MessageLite", True, "ParseFromString", "(const Cord &)", "", "Argument[*0]", "Argument[-1]", "taint", "manual"]
1812
- ["google::protobuf", "MessageLite", True, "ParsePartialFromString", "(string_view)", "", "Argument[0]", "Argument[-1]", "taint", "manual"]
@@ -40,7 +34,7 @@ extensions:
4034
- ["google::protobuf", "MessageLite", True, "MergeFromCodedStream", "", "", "Argument[*0]", "Argument[-1]", "taint", "manual"]
4135
- ["google::protobuf", "MessageLite", True, "MergePartialFromCodedStream", "", "", "Argument[*0]", "Argument[-1]", "taint", "manual"]
4236

43-
# Serialization into an output buffer/stream: the message (`this`) taints `Argument[*0]`.
37+
# Serialization
4438
- ["google::protobuf", "MessageLite", True, "SerializeToString", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"]
4539
- ["google::protobuf", "MessageLite", True, "SerializePartialToString", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"]
4640
- ["google::protobuf", "MessageLite", True, "AppendToString", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"]
@@ -58,7 +52,7 @@ extensions:
5852
- ["google::protobuf", "MessageLite", True, "SerializeToCodedStream", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"]
5953
- ["google::protobuf", "MessageLite", True, "SerializePartialToCodedStream", "", "", "Argument[-1]", "Argument[*0]", "taint", "manual"]
6054

61-
# Serialization returning the bytes: the message (`this`) taints the (by-value) return value.
55+
# Serialization returning bytes
6256
- ["google::protobuf", "MessageLite", True, "SerializeAsString", "", "", "Argument[-1]", "ReturnValue", "taint", "manual"]
6357
- ["google::protobuf", "MessageLite", True, "SerializePartialAsString", "", "", "Argument[-1]", "ReturnValue", "taint", "manual"]
6458
- ["google::protobuf", "MessageLite", True, "SerializeAsCord", "", "", "Argument[-1]", "ReturnValue", "taint", "manual"]

0 commit comments

Comments
 (0)