Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
regress: pty: fix or abort on memory corruption (re: ef1f56d)
The change from vmalloc to standard malloc exposed memory corruption problems in pty.c. src/cmd/builtin/pty.c: - Change a '==' that was clearly meant to be an assignment to '='. - Fix memory handling when growing buffer. The change from vmnewof to realloc introduces the need to manually reinitialise the added memory, something vmnewof did automatically. Also, the 'max' pointer, which is to point to the last byte in the buffer, was set to point one byte past the buffer in that case. - Throw internal error instead of crashing. It's the best I can do for now. The crash occurred under ASan on line 740 (*t++ = *s). The t pointer pointed to before the buffer bp->buf. This happens (via t = r on line 721) on line 699 (r -= bp->cursor). And that's all I have been able to figure out for now. src/cmd/ksh93/tests/pty.sh: - The internal error (see above) was only triggered for one of the tests. Disable that test until the cause of the incorrect pointer in pty.c is identified.
- Loading branch information