-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyes.patch
34 lines (31 loc) · 1.17 KB
/
yes.patch
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
From ecee86b66461021cde9b469ff0e82a992bea5f54 Mon Sep 17 00:00:00 2001
From: Mikhail Barashkov <[email protected]>
Date: Sat, 19 Jun 2021 14:12:11 +0300
Subject: [PATCH] yes: fix crash in E2k Protected mode
* yes crashed in E2K protected mode when reusing the argv buffer
---
src/yes.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/yes.c b/src/yes.c
index b6bd35a5e..533a4d9ae 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -98,7 +98,16 @@ main (int argc, char **argv)
}
/* Fill the buffer with one copy of the output. If possible, reuse
- the operands strings; this wins when the buffer would be large. */
+ the operands strings; this wins when the buffer would be large.
+ On the E2K platform in protected mode (-m128) reuse can't be used,
+ because in protected mode you are confined to specific pointers.
+ */
+ #ifdef __e2k__
+ if (sizeof(void*) == 16)
+ { // in protected mode, pointers are 128-bit
+ reuse_operand_strings = false;
+ }
+ #endif
char *buf = reuse_operand_strings ? *operands : xmalloc (bufalloc);
size_t bufused = 0;
operandp = operands;
--
2.28.0