This repository was archived by the owner on Jan 5, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
ql/test/library-tests/semmle/go/frameworks/Protobuf Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040| testModernApi.go:123:18:123:36 | untrustedSerialized | testModernApi.go:122:2:122:6 | definition of query |
4141| testModernApi.go:143:33:143:37 | query | testModernApi.go:143:2:143:38 | ... := ...[0] |
4242| testModernApi.go:154:33:154:37 | query | testModernApi.go:154:2:154:38 | ... := ...[0] |
43+ | testModernApi.go:168:12:168:16 | query | testModernApi.go:168:12:168:31 | call to ProtoReflect |
Original file line number Diff line number Diff line change @@ -155,3 +155,22 @@ func testSubmessageAliasFalseNegativeModern() {
155155
156156 sinkBytes (serialized ) // BAD (but not noticed by our current implementation)
157157}
158+
159+ // This test should be flagged, but we don't notice that marshalState2.Message is the
160+ // same as marshalState.Message.
161+ func testMarshalStateFalseNegative () {
162+ query := & query.Query {}
163+ query .Description = getUntrustedString ()
164+
165+ options := proto.MarshalOptions {}
166+ emptyArray := []byte {}
167+ marshalState := protoiface.MarshalInput {
168+ Message : query .ProtoReflect (),
169+ Buf : emptyArray ,
170+ Flags : 0 ,
171+ }
172+ marshalState2 := marshalState
173+ serialized , _ := options .MarshalState (marshalState2 )
174+
175+ sinkBytes (serialized .Buf ) // BAD (but not noticed by our current implementation)
176+ }
You can’t perform that action at this time.
0 commit comments