[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2262] Fix for bug #35093.
From: |
Dmitry Xmelkov |
Subject: |
[avr-libc-commit] [2262] Fix for bug #35093. |
Date: |
Sat, 24 Dec 2011 00:38:35 +0000 |
Revision: 2262
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2262
Author: dmix
Date: 2011-12-24 00:38:34 +0000 (Sat, 24 Dec 2011)
Log Message:
-----------
Fix for bug #35093. Thanks to Eric Mertens for the patch.
* libc/pmstring/strlcat_P.S: Fix X pointer decriment.
* libc/string/strlcat.S: Fix X pointer decriment.
* tests/regression/bug-35093.c: New file.
* NEWS: Add to fixed bug list.
Ticket Links:
------------
http://savannah.gnu.org/bugs/?35093
Modified Paths:
--------------
trunk/avr-libc/ChangeLog
trunk/avr-libc/NEWS
trunk/avr-libc/libc/pmstring/strlcat_P.S
trunk/avr-libc/libc/string/strlcat.S
Added Paths:
-----------
trunk/avr-libc/tests/simulate/regression/bug-35093.c
Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog 2011-12-09 07:05:46 UTC (rev 2261)
+++ trunk/avr-libc/ChangeLog 2011-12-24 00:38:34 UTC (rev 2262)
@@ -1,3 +1,11 @@
+2011-12-24 Dmitry Xmelkov <address@hidden>
+
+ Fix for bug #35093. Thanks to Eric Mertens for the patch.
+ * libc/pmstring/strlcat_P.S: Fix X pointer decriment.
+ * libc/string/strlcat.S: Fix X pointer decriment.
+ * tests/regression/bug-35093.c: New file.
+ * NEWS: Add to fixed bug list.
+
2011-12-09 Joerg Wunsch <address@hidden>
bug #35020: stdint.h: signed types need explicit "signed"
Modified: trunk/avr-libc/NEWS
===================================================================
--- trunk/avr-libc/NEWS 2011-12-09 07:05:46 UTC (rev 2261)
+++ trunk/avr-libc/NEWS 2011-12-24 00:38:34 UTC (rev 2262)
@@ -18,6 +18,7 @@
[#33920] ICR1 incorrectly defined for tiny167
[#34047] missing math.h include in delay.h
[#35020] stdint.h: signed types need explicit "signed"
+ [#35093] strlcat_P fails for some destinations
[no-id] New names for CLKSTA/CLKSEL0/1 for AT90USB82/162
system when power_all_disable() is used
[no-id] util/delay.h would not compile with -ffreestanding
Modified: trunk/avr-libc/libc/pmstring/strlcat_P.S
===================================================================
--- trunk/avr-libc/libc/pmstring/strlcat_P.S 2011-12-09 07:05:46 UTC (rev
2261)
+++ trunk/avr-libc/libc/pmstring/strlcat_P.S 2011-12-24 00:38:34 UTC (rev
2262)
@@ -102,7 +102,7 @@
ld __tmp_reg__, X+
tst __tmp_reg__
brne 1b
- subi XL, 1
+ sbiw XL, 1
rjmp 3f
; copy loop
Modified: trunk/avr-libc/libc/string/strlcat.S
===================================================================
--- trunk/avr-libc/libc/string/strlcat.S 2011-12-09 07:05:46 UTC (rev
2261)
+++ trunk/avr-libc/libc/string/strlcat.S 2011-12-24 00:38:34 UTC (rev
2262)
@@ -96,7 +96,7 @@
ld __tmp_reg__, X+
tst __tmp_reg__
brne 1b
- subi XL, 1
+ sbiw XL, 1
rjmp 3f
; copy loop
Added: trunk/avr-libc/tests/simulate/regression/bug-35093.c
===================================================================
--- trunk/avr-libc/tests/simulate/regression/bug-35093.c
(rev 0)
+++ trunk/avr-libc/tests/simulate/regression/bug-35093.c 2011-12-24
00:38:34 UTC (rev 2262)
@@ -0,0 +1,104 @@
+/* Copyright (c) 2011 Dmitry Xmelkov
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of the copyright holders nor the names of
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* bug #35093: strlcat_P fails for some destinations
+ $Id$ */
+
+#ifndef __AVR__
+
+/* Omit the test, as strlcat() is not a standart C function. */
+int main () { return 0; }
+
+#else
+
+#include <avr/io.h>
+#include <avr/pgmspace.h>
+#include <string.h>
+
+int main ()
+{
+ /* To activiate this bug, it is needed 0xXXFF address of terminated
+ zero byte. */
+# if RAMEND >= 511
+ char s[260];
+# else
+ char s[8]; /* Too small SRAM: omit testing. */
+# endif
+ int i, n;
+
+ /* strlcat_P() */
+ for (n = 0; n < (int)sizeof (s) - 2; n++) {
+ for (i = 0; i < n; i++)
+ s[i] = 'A';
+ s[i] = 0;
+
+ i = strlcat_P (s, PSTR (""), sizeof (s));
+ if (i != n)
+ return __LINE__;
+
+ i = strlcat_P (s, PSTR ("B"), sizeof (s));
+ if (i != n + 1)
+ return __LINE__;
+ for (i = 0; i < n; i++) {
+ if (s[i] != 'A')
+ return __LINE__;
+ }
+ if (s[i++] != 'B')
+ return __LINE__;
+ if (s[i])
+ return __LINE__;
+ }
+
+ /* strlcat() */
+ for (n = 0; n < (int)sizeof (s) - 2; n++) {
+ for (i = 0; i < n; i++)
+ s[i] = 'A';
+ s[i] = 0;
+
+ i = strlcat (s, "", sizeof (s));
+ if (i != n)
+ return __LINE__;
+
+ i = strlcat (s, "B", sizeof (s));
+ if (i != n + 1)
+ return __LINE__;
+ for (i = 0; i < n; i++) {
+ if (s[i] != 'A')
+ return __LINE__;
+ }
+ if (s[i++] != 'B')
+ return __LINE__;
+ if (s[i])
+ return __LINE__;
+ }
+
+ return 0;
+}
+
+#endif /* __AVR__ */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2262] Fix for bug #35093.,
Dmitry Xmelkov <=