File: fix-testsgofuzzcrashers.patch

package info (click to toggle)
golang-github-streadway-amqp 0.0~git20150820.0.f4879ba-6
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-backports
  • size: 480 kB
  • sloc: xml: 495; sh: 126; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 795 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Description: Fix TestsGoFuzzCrashers
 Limit readLongstr to max(uint32) because slices on 386 can be at most of max(uint32) size
Author: Philipp Hug <hug@debian.org>
Origin: upstream
Bug: https://github.com/streadway/amqp/issues/261
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=860684
Forwarded: https://github.com/streadway/amqp/pull/265
Last-Update: 2017-05-06

---

--- golang-github-streadway-amqp-0.0~git20150820.0.f4879ba.orig/read.go
+++ golang-github-streadway-amqp-0.0~git20150820.0.f4879ba/read.go
@@ -109,6 +109,11 @@ func readLongstr(r io.Reader) (v string,
 		return
 	}
 
+	// slices can't be longer than max int32 value
+	if (length > (^uint32(0) >> 1)) {
+		return
+	}
+
 	bytes := make([]byte, length)
 	if _, err = io.ReadFull(r, bytes); err != nil {
 		return