diff options
Diffstat (limited to 'generic/tclTest.c')
| -rw-r--r-- | generic/tclTest.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index 42eff25..2178647 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -6841,13 +6841,13 @@ TestUtfNextCmd( } } - if (numBytes > (int)sizeof(buffer)-2) { - Tcl_AppendResult(interp, "\"testutfnext\" can only handle 30 bytes", NULL); + if (numBytes > (int)sizeof(buffer)-3) { + Tcl_AppendResult(interp, "\"testutfnext\" can only handle 29 bytes", NULL); return TCL_ERROR; } memcpy(buffer + 1, bytes, numBytes); - buffer[0] = buffer[numBytes + 1] = '\x00'; + buffer[0] = buffer[numBytes + 1] = buffer[numBytes + 2] = '\x00'; first = result = TclUtfNext(buffer + 1); while ((buffer[0] = *p++) != '\0') { @@ -6858,6 +6858,15 @@ TestUtfNextCmd( return TCL_ERROR; } } + p = tobetested; + while ((buffer[numBytes + 1] = *p++) != '\0') { + /* Run Tcl_UtfNext with many more possible bytes at src[end], all should give the same result */ + result = TclUtfNext(buffer + 1); + if (first != result) { + Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[end]", NULL); + return TCL_ERROR; + } + } Tcl_SetObjResult(interp, Tcl_NewIntObj(first - buffer - 1)); |
