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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
From ea9aafc41a764e4e2dbb88a7b031e886b481b99a Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Tue, 27 Jun 2017 14:43:49 +0930
Subject: [PATCH] Warning fix
PR binutils/21665
* libbfd.c (_bfd_generic_get_section_contents): Warning fix.
(_bfd_generic_get_section_contents_in_window): Likewise.
Upstream-Status: Backport
CVE: CVE-2017-9955 #6
Signed-off-by: Armin Kuster <akuster@mvista.com>
---
bfd/ChangeLog | 12 +++++++++---
bfd/libbfd.c | 4 ++--
2 files changed, 11 insertions(+), 5 deletions(-)
Index: git/bfd/libbfd.c
===================================================================
--- git.orig/bfd/libbfd.c
+++ git/bfd/libbfd.c
@@ -806,7 +806,7 @@ _bfd_generic_get_section_contents (bfd *
filesz = bfd_get_file_size (abfd);
if (offset + count < count
|| offset + count > sz
- || section->filepos + offset + count > filesz)
+ || (ufile_ptr) section->filepos + offset + count > filesz)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
@@ -864,7 +864,7 @@ _bfd_generic_get_section_contents_in_win
sz = section->size;
filesz = bfd_get_file_size (abfd);
if (offset + count > sz
- || section->filepos + offset + count > filesz
+ || (ufile_ptr) section->filepos + offset + count > filesz
|| ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
TRUE))
return FALSE;
Index: git/bfd/ChangeLog
===================================================================
--- git.orig/bfd/ChangeLog
+++ git/bfd/ChangeLog
@@ -1,5 +1,11 @@
2017-06-27 Alan Modra <amodra@gmail.com>
+ PR binutils/21665
+ * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
+ (_bfd_generic_get_section_contents_in_window): Likewise.
+
+2017-06-27 Alan Modra <amodra@gmail.com>
+
PR binutils/21665
* libbfd.c (_bfd_generic_get_section_contents): Delete abort.
Use unsigned file pointer type, and remove cast.
|