|
| 1 | +From a43fa39c1012862334a186e4c3a9c67e7d111461 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Suresh Thelkar <sthelkar@microsoft.com> |
| 3 | +Date: Thu, 5 Dec 2024 10:28:31 +0530 |
| 4 | +Subject: [PATCH] Patch for CVE-2024-24786 |
| 5 | + |
| 6 | +Upstream patch details are given below. |
| 7 | +https://github.com/protocolbuffers/protobuf-go/commit/f01a588 |
| 8 | +--- |
| 9 | + .../protobuf/encoding/protojson/well_known_types.go | 4 ++++ |
| 10 | + .../protobuf/internal/encoding/json/decode.go | 2 +- |
| 11 | + 2 files changed, 5 insertions(+), 1 deletion(-) |
| 12 | + |
| 13 | +diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go b/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go |
| 14 | +index c85f846..634ba41 100644 |
| 15 | +--- a/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go |
| 16 | ++++ b/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go |
| 17 | +@@ -348,6 +348,10 @@ func (d decoder) skipJSONValue() error { |
| 18 | + } |
| 19 | + } |
| 20 | + } |
| 21 | ++ case json.EOF: |
| 22 | ++ // This can only happen if there's a bug in Decoder.Read. |
| 23 | ++ // Avoid an infinite loop if this does happen. |
| 24 | ++ return errors.New("unexpected EOF") |
| 25 | + } |
| 26 | + return nil |
| 27 | + } |
| 28 | +diff --git a/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go |
| 29 | +index b13fd29..b2be4e8 100644 |
| 30 | +--- a/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go |
| 31 | ++++ b/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go |
| 32 | +@@ -121,7 +121,7 @@ func (d *Decoder) Read() (Token, error) { |
| 33 | + |
| 34 | + case ObjectClose: |
| 35 | + if len(d.openStack) == 0 || |
| 36 | +- d.lastToken.kind == comma || |
| 37 | ++ d.lastToken.kind&(Name|comma) != 0 || |
| 38 | + d.openStack[len(d.openStack)-1] != ObjectOpen { |
| 39 | + return Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString()) |
| 40 | + } |
| 41 | +-- |
| 42 | +2.34.1 |
| 43 | + |
0 commit comments