Module Name:    src
Committed By:   matt
Date:           Tue May 26 06:55:08 UTC 2015

Modified Files:
        src/common/lib/libc/arch/mips/string: strchr.S strrchr.S

Log Message:
force 2nd to argument to unsigned byte value.
(found by t_strchr and t_strrchr tests)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/mips/string/strchr.S
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/mips/string/strrchr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/arch/mips/string/strchr.S
diff -u src/common/lib/libc/arch/mips/string/strchr.S:1.3 src/common/lib/libc/arch/mips/string/strchr.S:1.4
--- src/common/lib/libc/arch/mips/string/strchr.S:1.3	Sun Jan  2 02:58:52 2011
+++ src/common/lib/libc/arch/mips/string/strchr.S	Tue May 26 06:55:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strchr.S,v 1.3 2011/01/02 02:58:52 matt Exp $	*/
+/*	$NetBSD: strchr.S,v 1.4 2015/05/26 06:55:08 matt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 	ASMSTR("from: @(#)index.s	8.1 (Berkeley) 6/4/93")
-	ASMSTR("$NetBSD: strchr.S,v 1.3 2011/01/02 02:58:52 matt Exp $")
+	ASMSTR("$NetBSD: strchr.S,v 1.4 2015/05/26 06:55:08 matt Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef __ABICALLS__
@@ -45,6 +45,7 @@
 
 LEAF(strchr)
 XLEAF(index)
+	and	a1, 0xff		# limit to byte value
 1:
 	lbu	a2, 0(a0)		# get a byte
 	PTR_ADDU a0, 1

Index: src/common/lib/libc/arch/mips/string/strrchr.S
diff -u src/common/lib/libc/arch/mips/string/strrchr.S:1.2 src/common/lib/libc/arch/mips/string/strrchr.S:1.3
--- src/common/lib/libc/arch/mips/string/strrchr.S:1.2	Sun Jan  2 02:58:52 2011
+++ src/common/lib/libc/arch/mips/string/strrchr.S	Tue May 26 06:55:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strrchr.S,v 1.2 2011/01/02 02:58:52 matt Exp $	*/
+/*	$NetBSD: strrchr.S,v 1.3 2015/05/26 06:55:08 matt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 	ASMSTR("from: @(#)rindex.s	8.1 (Berkeley) 6/4/93")
-	ASMSTR("$NetBSD: strrchr.S,v 1.2 2011/01/02 02:58:52 matt Exp $")
+	ASMSTR("$NetBSD: strrchr.S,v 1.3 2015/05/26 06:55:08 matt Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef __ABICALLS__
@@ -45,6 +45,7 @@
 
 LEAF(strrchr)
 XLEAF(rindex)
+	and	a1, 0xff		# limit to byte value
 	move	v0, zero		# default if not found
 1:
 	lbu	a3, 0(a0)		# get a byte

Reply via email to