tags 535318 + patch
thanks

Chris Lamb wrote:

> Can you even reproduce it?

Traceback (and patch) attached, but that's only because I'm stubborn. The
real solution is to package an upstream snapshot.

Upstream is not dead, they just haven't made a release in a while. Plus (as
Oz is finding out) the version in Debian has been disowned by upstream and
probably shouldn't be in another stable release. Very few changes seem
required to update too; just looks like you need to drop 'g2c' from
libraries_list in setup.py.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org
       `-
% gdb python-dbg
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) run -c "from pysparse import spmatrix; A = spmatrix.ll_mat(5, 5); c = [4, 
5, 9]; a = [1,3,5]; b = [2,3,5]; A = A.put(c, a, b); print A" 
Starting program: /usr/bin/python-dbg -c "from pysparse import spmatrix; A = 
spmatrix.ll_mat(5, 5); c = [4, 5, 9]; a = [1,3,5]; b = [2,3,5]; A = A.put(c, a, 
b); print A"
[Thread debugging using libthread_db enabled]
[New Thread 0xf7deb6b0 (LWP 4587)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf7deb6b0 (LWP 4587)]
0xf7d5d953 in SpMatrix_LLMatSetItem (a=0xf6dcce88, i=5, j=5, x=9) at 
Src/ll_mat.c:170
170         col = a->col[k];
(gdb) bt
#0  0xf7d5d953 in SpMatrix_LLMatSetItem (a=0xf6dcce88, i=5, j=5, x=9) at 
Src/ll_mat.c:170
#1  0xf7d5ddb8 in LLMat_put (self=0xf6dcce88, args=0xf75bba74) at 
Src/ll_mat.c:1850
#2  0x08149c56 in PyCFunction_Call (func=0xf7da26c4, arg=0xf75bba74, kw=0x0) at 
../Objects/methodobject.c:73
#3  0x080ec502 in call_function (pp_stack=0xff8cef34, oparg=3) at 
../Python/ceval.c:3575
#4  0x080e7d03 in PyEval_EvalFrameEx (f=0x8f3b9ac, throwflag=0) at 
../Python/ceval.c:2274
#5  0x080ea1dc in PyEval_EvalCodeEx (co=0xf7ddbb08, globals=0xf7dd1214, 
locals=0xf7dd1214, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, 
defcount=0, closure=0x0) at ../Python/ceval.c:2838
#6  0x080df69e in PyEval_EvalCode (co=0xf7ddbb08, globals=0xf7dd1214, 
locals=0xf7dd1214) at ../Python/ceval.c:494
#7  0x08114274 in run_mod (mod=0x8f6eef8, filename=0x81764b9 "<string>", 
globals=0xf7dd1214, locals=0xf7dd1214, flags=0xff8cf208, arena=0x8f40ae8) at 
../Python/pythonrun.c:1273
#8  0x08114136 in PyRun_StringFlags (str=0x8f2d008 "from pysparse import 
spmatrix; A = spmatrix.ll_mat(5, 5); c = [4, 5, 9]; a = [1,3,5]; b = [2,3,5]; A 
= A.put(c, a, b); print A\n", start=257, globals=0xf7dd1214, locals=0xf7dd1214, 
    flags=0xff8cf208) at ../Python/pythonrun.c:1236
#9  0x08112e8e in PyRun_SimpleStringFlags (command=0x8f2d008 "from pysparse 
import spmatrix; A = spmatrix.ll_mat(5, 5); c = [4, 5, 9]; a = [1,3,5]; b = 
[2,3,5]; A = A.put(c, a, b); print A\n", flags=0xff8cf208)
    at ../Python/pythonrun.c:900
#10 0x08059bf7 in Py_Main (argc=3, argv=0xff8cf314) at ../Modules/main.c:521
#11 0x08058d16 in main (argc=Cannot access memory at address 0xefefefec
) at ../Modules/python.c:23

diff -urNd pysparse-1.0.1.orig/Src/ll_mat.c pysparse-1.0.1/Src/ll_mat.c
--- pysparse-1.0.1.orig/Src/ll_mat.c    2009-08-04 21:38:49.000000000 +0100
+++ pysparse-1.0.1/Src/ll_mat.c 2009-08-04 21:39:39.000000000 +0100
@@ -163,6 +163,11 @@
     return -1;
   } 
 
+  if (i < 0 || i >= a->dim[0] || j < 0 || j >= a->dim[1]) {
+    PyErr_SetString(PyExc_IndexError, "indices out of range");
+    return -1;
+  }
+
   /* find element to be set (or removed) */
   col = last = -1;
   k = a->root[i]; 

Attachment: signature.asc
Description: PGP signature

Reply via email to