Attachment "tclCmdMZ.c.patch" to
ticket [3475667fff]
added by
sebres
2012-01-19 08:37:26.
Index: tclCmdMZ.c
===================================================================
--- tclCmdMZ.c
+++ tclCmdMZ.c
@@ -264,9 +264,12 @@
* considered the start of the line. If for example the pattern {^} is
* passed and -start is positive, then the pattern will not match the
* start of the string unless the previous character is a newline.
+ *
+ * [SEBRES] offset > 0 is needless (boolean logic (offs == 0 || ...)), negative already checked above
+ * (offset < stringLength) prevents access violation for -start offsets greater as length.
*/
- if ((offset == 0) || ((offset > 0) &&
+ if ((offset == 0) || ((offset < stringLength) &&
(Tcl_GetUniChar(objPtr, offset-1) == (Tcl_UniChar)'\n'))) {
eflags = 0;
} else {