Fixed a crash in case of garbage following a valid directive.#1
Fixed a crash in case of garbage following a valid directive.#1giusguerrini wants to merge 1 commit intodbremner:masterfrom
Conversation
|
Thanks for the PR. I can see how this avoids the crash, but I'd like to understand the root cause before merging. |
|
Hi dbremmer, here's a minimal example of C source that generates the exception: As you correctly supposed, the exception is due to the fact that the string containing the original line is compressed to remove additional spaces, but the index of the offending character (a double quote in this case) is not decreased accordingly. |
In case of line like
i.e., there is garbage after a valid directive, and there are many spaces in between, the program termintated wih an exception. The program crashed because of an index overflow in a string. The offending code is in the construction of the error message. To fix it, I simplified the error message by showing the whole line instead of the parts. It is not perfect, because the message is slightly less precise, but in my opinion it's explanatory enough.