There seems to be a bug in Ploticus that causes random errors in timelines generated by EasyTimeline. The pictures have these random lines with one end in the lower left corner. Here is a test page to show the problem [https://fi.wikibooks.org/wiki/K%C3%A4ytt%C3%A4j%C3%A4:Hunsvotti/timeline-issue]. All the images have the same input, yet one is mangled. (I had to change the amount of whitespace in the scripts, because the software was smart enough to use the same image otherwise. It's not relevant here.)
This problem is in Plotibus not in EasyTimeline. If you take the output of EasyTimeline.pl with, for example, the
input above and give it to the pl executable a number of times, you should see the same random bug appear there. For example generating a hundred
images with the same input, 13 have the bug appear:
> for index in $(seq 1 100); do
ploticus/pl241src/src/pl -png -o "./test/testi-$index.png" './piano-c–e–g–b♭–d♯–f–a.txt' -tightcrop -font 'ascii';
done
Output: {F26615856}
----
A Proposed fix. I've already looked at the problem and think I have found the problem.
On lines 460 and 488 there are these for-loops with ending condition iline <= procstop.
```
460 for( iline = txtstartline; iline <= procstop ; iline++ ) {
```
```
488 for( iline = txtstartline; iline <= txtstopline; iline++ ) {
```
This causes a line to be read past the array PLL.procline on line 489 and some garbage been appended to the buffer on line 495. It's then
returned to back to proc_line.c: 70. The garbage is counted as a string. The conditional on line 73 gets the wrong count and branches to wonky town!
I think the fix is to change the loop condition on line 488 to not allow iline to be equal to procstop. (Patch: {F26615905})
```
460 for( iline = txtstartline; iline < procstop ; iline++ ) {
```
On line 488 the procstop condition seems useless since txtstopline is already capped to it after the previous loop (line 468). So line 488 could be
```
488 for( iline = txtstartline; iline < txtstopline; iline++ ) {
```
I am not sure if this fix will cause some other problems. I've tested it with some random timelines I donwloaded from Wikipedia and none of them
seems to have any issues. Also if you look at how procstop is set in execline.c. At line 398 it is set start position + length, and on 403 to
number of lines, it would make sense the iline pointer should never be equal to procstop.
I coudn't get the error to appear on any of the Ploticus testsuit files. So, there might be something in Timeline generated files that makes it visble.