731.11.386
by Arnold D. Robbins
Fix coredump from IGNORECASE array sorting. |
1 |
# This should no longer core dump ... 7/31/2018
|
2 |
function init(b, a, i) |
|
3 |
{
|
|
4 |
a[1] = "aardvark" |
|
5 |
a[2] = "animal" |
|
6 |
a[3] = "zebra" |
|
7 |
a[4] = "zoo" |
|
8 |
a[5] = "Iguana" |
|
9 |
a[6] = "Alligator" |
|
10 |
a[7] =a[8] = "people" |
|
11 |
for (i in a) |
|
12 |
b[IGNORECASE][i] = a[i] |
|
13 |
}
|
|
14 |
||
15 |
BEGIN { |
|
16 |
||
17 |
for (IGNORECASE = 0; IGNORECASE < 2; IGNORECASE++) { |
|
18 |
init(b) |
|
19 |
||
20 |
n = asort(b[IGNORECASE]) |
|
21 |
||
22 |
for (i = 1; i <= n; i++) |
|
23 |
printf("b[%d][%d] = \"%s\"\n", IGNORECASE, i, b[IGi]) |
|
24 |
||
25 |
print "====" |
|
26 |
}
|
|
27 |
||
28 |
IGNORECASE = 1 |
|
29 |
init(b) |
|
30 |
b[2][1] = "" |
|
31 |
n = asort(b[1], b[2]) |
|
32 |
for (i = 1; i <= n; i++) |
|
33 |
printf("b[2][%d] = \"%s\"\n", i, b[2][i]) |
|
34 |
}
|