Debian Codegraph @

debian/patches/716481

raw
1 From: =?utf-8?b?0L3QsNCx?= <[email protected]>
2 Date: Fri, 31 Jan 2025 12:29:24 +0100
3 Subject: Limit ranges to INT_MAX (they're stored in an int later),
4 else x86dis rMAAAAAAAA 0x -5 segfaults (Closes: #716481)
5
6 ---
7 x86dis/x86dis.c | 10 +++++++---
8 1 file changed, 7 insertions(+), 3 deletions(-)
9
10 diff --git a/x86dis/x86dis.c b/x86dis/x86dis.c
11 index 0bc4e83..2cfe032 100644
12 --- a/x86dis/x86dis.c
13 +++ b/x86dis/x86dis.c
14 @@ -20,6 +20,7 @@
15 #include <fcntl.h>
16 #include <stdlib.h>
17 #include <string.h>
18 +#include <limits.h>
19 #include <stdio.h>
20 #include <sys/mman.h>
21 #include <sys/stat.h>
22 @@ -712,10 +713,13 @@ int main( int argc, char **argv ) {
23 x+=2;
24 if ( x < argc ) {
25 off = strtoul( argv[x-1], NULL, 0 );
26 - len = (unsigned int)
27 + len = (unsigned int)
28 strtoul(argv[x], NULL, 0);
29 - add_request( req_range, off,
30 - len );
31 + if ( len >= INT_MAX )
32 + error = 1;
33 + else
34 + add_request( req_range, off,
35 + len );
36 } else {
37 error = 1;
38 }