tr: set2 must be set in some cases
echo abc | tr 'a' '' would crash because of: m--; r = set2[m].start + (off1 - off2) / set2[m].quant; if set2ranges > 0 it's fine.
This commit is contained in:
parent
4469b0b641
commit
14c5ab48d5
2
tr.c
2
tr.c
|
@ -196,6 +196,8 @@ main(int argc, char *argv[])
|
||||||
set1ranges = makeset(argv[0], &set1);
|
set1ranges = makeset(argv[0], &set1);
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
set2ranges = makeset(argv[1], &set2);
|
set2ranges = makeset(argv[1], &set2);
|
||||||
|
if (!dflag && !set2ranges)
|
||||||
|
eprintf("set2 must be non-empty\n");
|
||||||
read:
|
read:
|
||||||
if (!readrune("<stdin>", stdin, &r))
|
if (!readrune("<stdin>", stdin, &r))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user