src/components/strings.jl
changed.
Showing 1 of 1 files from the diff.
@@ -37,20 +37,12 @@
Loading
37 | 37 | (isempty(str) || (lcp !== nothing && isempty(lcp))) && return |
|
38 | 38 | (last && str[end] == '\n') && return (lcp = "") |
|
39 | 39 | idxstart, idxend = 2, 1 |
|
40 | - | safetytrip = 0 |
|
40 | + | prevpos = idxend |
|
41 | 41 | while nextind(str, idxend) - 1 < sizeof(str) && (lcp === nothing || !isempty(lcp)) |
|
42 | - | safetytrip += 1 |
|
43 | - | if safetytrip > 10_000 |
|
44 | - | throw(CSTInfiniteLoop("Infinite loop.")) |
|
45 | - | end |
|
46 | 42 | idxend = skip_to_nl(str, idxend) |
|
47 | 43 | idxstart = nextind(str, idxend) |
|
48 | - | safetytrip1 = 0 |
|
44 | + | prevpos1 = idxend |
|
49 | 45 | while nextind(str, idxend) - 1 < sizeof(str) |
|
50 | - | safetytrip1 += 1 |
|
51 | - | if safetytrip1 > 10_000 |
|
52 | - | throw(CSTInfiniteLoop("Infinite loop.")) |
|
53 | - | end |
|
54 | 46 | c = str[nextind(str, idxend)] |
|
55 | 47 | if c == ' ' || c == '\t' |
|
56 | 48 | idxend += 1 |
@@ -63,6 +55,16 @@
Loading
63 | 55 | lcp = lcp === nothing ? prefix : longest_common_prefix(lcp, prefix) |
|
64 | 56 | break |
|
65 | 57 | end |
|
58 | + | if idxend <= prevpos1 |
|
59 | + | throw(CSTInfiniteLoop("Infinite loop in adjust_lcp")) |
|
60 | + | else |
|
61 | + | prevpos1 = idxend |
|
62 | + | end |
|
63 | + | end |
|
64 | + | if idxend < prevpos |
|
65 | + | throw(CSTInfiniteLoop("Infinite loop in adjust_lcp")) |
|
66 | + | else |
|
67 | + | prevpos = idxend |
|
66 | 68 | end |
|
67 | 69 | end |
|
68 | 70 | if idxstart != nextind(str, idxend) |
@@ -100,11 +102,8 @@
Loading
100 | 102 | seek(input, startbytes) |
|
101 | 103 | b = IOBuffer() |
|
102 | 104 | safetytrip = 0 |
|
105 | + | prevpos = position(input) |
|
103 | 106 | while !eof(input) |
|
104 | - | safetytrip += 1 |
|
105 | - | if safetytrip > length(str2) # This is iterating over characters, not parsed expressions - 10,000 was in inappropriate limit. |
|
106 | - | throw(CSTInfiniteLoop("Infinite loop parsing: \"$str2\"")) |
|
107 | - | end |
|
108 | 107 | c = read(input, Char) |
|
109 | 108 | if c == '\\' |
|
110 | 109 | write(b, c) |
@@ -160,6 +159,7 @@
Loading
160 | 159 | else |
|
161 | 160 | write(b, c) |
|
162 | 161 | end |
|
162 | + | prevpos = loop_check(input, prevpos) |
|
163 | 163 | end |
|
164 | 164 | ||
165 | 165 | # handle last String section |
Files | Coverage |
---|---|
src | 86.01% |
Project Totals (14 files) | 86.01% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.