eric pouech (@epo) commented about programs/cmd/lineedit.c:
}oldCurPos = curPos;curPos = 0;while (curPos < len &&inputBuffer[curPos] != L'\t' &&inputBuffer[curPos] != L'\x1B') {curPos++;}/* curPos is often numRead - 1, but not always, as in the case where history is retrieved* and then user backspaces to somewhere mid-string and then hits Tab.*/TRACE("numRead: %lu, curPos: %u\n", *numRead, curPos);switch (inputBuffer[curPos]) {
looks to be that curPos can be > *numRead, hence reading garbage in that case