this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

protobuf/jsonpb: fix panic when decoding non-string bytes

```
exec cue eval schema.cue json+pb: data.json
-- schema.cue --
t: bytes @protobuf(1, bytes)
-- data.json --
{"t": 42}
```

This would panic because of a logic error in jsonpb/decoder.go

Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: Ie9c0bf1670a01f3223fb85d354a36ff1dfacedda
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1234625
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>

+7 -1
+1 -1
encoding/protobuf/jsonpb/decoder.go
··· 209 209 210 210 case cue.BytesKind: 211 211 x, q, str := stringValue(expr) 212 - if x == nil && q.IsDouble() { 212 + if x == nil { 213 213 break 214 214 } 215 215
+6
encoding/protobuf/jsonpb/testdata/decoder/bytes_nonstring.txtar
··· 1 + -- schema.cue -- 2 + b: [string]: bytes 3 + -- int.cue -- 4 + b: field: 42 5 + -- out/jsonpb/int.cue -- 6 + b: field: 42