Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 219 by
b845...@klzlk.com: make error "array subscript is above
array bounds" for v>=1.4.5 on Opensuse; patch workaround included
http://code.google.com/p/memcached/issues/detail?id=219
lsb_release -rd
Description: openSUSE 11.4 (i586)
Release: 11.4
uname -sr
Linux 2.6.37.6-0.7-default
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i586-suse-linux/4.5/lto-wrapper
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.5
--enable-ssp --disable-libssp --disable-plugin
--with-bugurl=
http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --disable-libmudflap --with-slibdir=/lib
--with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new
--disable-libstdcxx-pch --enable-version-specific-runtime-libs
--program-suffix=-4.5 --enable-linux-futex --without-system-libunwind
--enable-gold --with-plugin-ld=/usr/bin/gold --with-arch-32=i586
--with-tune=generic --build=i586-suse-linux
Thread model: posix
gcc version 4.5.3 20110428 [gcc-4_5-branch revision 173117] (SUSE Linux)
cd /usr/local/src
rm -rf memcached*
setenv MEMC_VER "1.4.7"
wget
http://memcached.googlecode.com/files/memcached-${MEMC_VER}.tar.gz
tar zxvf memcached*gz
cd /usr/local/src/memcached*/
./configure
make
make all-recursive
make[1]: Entering directory `/usr/local/src/memcached-1.4.7'
Making all in doc
make[2]: Entering directory `/usr/local/src/memcached-1.4.7/doc'
make all-am
make[3]: Entering directory `/usr/local/src/memcached-1.4.7/doc'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/usr/local/src/memcached-1.4.7/doc'
make[2]: Leaving directory `/usr/local/src/memcached-1.4.7/doc'
make[2]: Entering directory `/usr/local/src/memcached-1.4.7'
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -DNDEBUG -O2 -mtune=generic
-march=native -pthread -Wall -Werror -pedantic -Wmissing-prototypes
-Wmissing-declarations -Wredundant-decls -MT memcached-memcached.o -MD -MP
-MF .deps/memcached-memcached.Tpo -c -o memcached-memcached.o `test
-f 'memcached.c' || echo './'`memcached.c
cc1: warnings being treated as errors
memcached.c: In function ‘try_read_command’:
memcached.c:2359:9: error: array subscript is above array bounds
memcached.c:2359:9: error: array subscript is above array bounds
memcached.c:2363:14: error: array subscript is above array bounds
memcached.c:2363:14: error: array subscript is above array bounds
memcached.c:2363:14: error: array subscript is above array bounds
make[2]: *** [memcached-memcached.o] Error 1
make[2]: Leaving directory `/usr/local/src/memcached-1.4.7'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/memcached-1.4.7'
make: *** [all] Error 2
applying a found patch
(
https://svn.erp5.org/repos/public/erp5/trunk/patches/memcached-1.4-fix-array-subscript-is-above-array-bounds.patch)
seems to remedy the problem,
cat fix-array-subscript-is-above-array-bounds.patch
# zypper si memcached
# cat /usr/src/packages/SOURCES/memcached-1.4.5.dif
--- memcached.c.orig 2011-07-12 00:37:00.000000000 -0700
+++ memcached.c 2011-07-17 20:14:53.000000000 -0700
@@ -2360,15 +2360,18 @@
inline static void process_stats_detail(conn *c, const char *command) {
assert(c != NULL);
- if (strcmp(command, "on") == 0) {
+ char on[] = "on";
+ char off[] = "off";
+ char dump[] = "dump";
+ if (strcmp(command, on) == 0) {
settings.detail_enabled = 1;
out_string(c, "OK");
}
- else if (strcmp(command, "off") == 0) {
+ else if (strcmp(command, off) == 0) {
settings.detail_enabled = 0;
out_string(c, "OK");
}
- else if (strcmp(command, "dump") == 0) {
+ else if (strcmp(command, dump) == 0) {
int len;
char *stats = stats_prefix_dump(&len);
write_and_free(c, stats, len);
cd /usr/local/src/memcached*/
make clean
patch -p0 < ../fix-array-subscript-is-above-array-bounds.patch
patching file memcached.c
Hunk #1 succeeded at 2356 (offset -4 lines).
./configure
make
...
make[2]: Leaving directory `/usr/local/src/memcached-1.4.7'
make[1]: Leaving directory `/usr/local/src/memcached-1.4.7'
>
make install
ls -al `which memcached`
-rwxr-xr-x 1 root root 93136 Aug 21 13:34 /usr/local/bin/memcached