Opened 4 years ago

Closed 4 years ago

#22862 closed defect (fixed)

Invalid pointers in sympow on OpenSuSE

Reported by: rws Owned by:
Priority: major Milestone: sage-8.0
Component: packages: standard Keywords:
Cc: Merged in:
Authors: Ralf Stephan Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: d4a673a (Commits, GitHub, GitLab) Commit: d4a673a4d88c9b68c3904517543d753fe7b74399
Dependencies: Stopgaps:

Status badges

Description

On OpenSuSE which apparently has a stricter memory checking:

sage: sympow.analytic_rank(EllipticCurve('11a'))
...
/home/ralf/sage/local/lib/python2.7/site-packages/sage/lfunctions/sympow.pyc in analytic_rank(self, E)
    295         if i == -1:
    296             print(self._fix_err(v))
--> 297             raise RuntimeError("failed to compute analytic rank")
    298         j = v.rfind(':')
    299         r = sage.rings.all.Integer(v[i+len(s):j])

RuntimeError: failed to compute analytic rank

*** Error in `./sympow': free(): invalid pointer: 0xbabababababababa ***
======= Backtrace: =========
/lib64/libc.so.6(+0x721af)[0x7ffff7aab1af]
/lib64/libc.so.6(+0x779d6)[0x7ffff7ab09d6]
./sympow[0x430d05]
./sympow[0x401aaa]
./sympow[0x4014d4]

etc

Change History (10)

comment:1 Changed 4 years ago by dimpase

this probably can be debugged by running sympow separately under valgrind.

comment:2 Changed 4 years ago by rws

ralf@ark:~/sage/local/lib/sympow> valgrind --tool=memcheck --leak-check=full ./sympow -curve "[0,-1,1,-10,-20]" -analrank
==19930== Memcheck, a memory error detector
==19930== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==19930== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==19930== Command: ./sympow -curve [0,-1,1,-10,-20] -analrank
==19930== 
sympow 1.018 RELEASE  (c) Mark Watkins --- see README and COPYING for details
Minimal model of curve  is [0,-1,1,-10,-20]
At 11: Inertia Group is  C1 MULTIPLICATIVE REDUCTION
Conductor is 11
sp 1: Conductor at 11 is 1+0, root number is -1
sp 1: Euler factor at 11 is 1-1*x
1st sym power conductor is 11, global root number is 1
NT 1d0: 7
Maximal number of terms is 7
Done with small primes 1049
==19930== Conditional jump or move depends on uninitialised value(s)
==19930==    at 0x4C2A382: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==19930==    by 0x430D04: free_data (util.c:26)
==19930==    by 0x401AA9: prep_analrank (analrank.c:21)
==19930==    by 0x4014D3: main (main.c:64)
==19930== 
Analytic Rank is 0 : L-value 2.53842e-01
==19930== 
==19930== HEAP SUMMARY:
==19930==     in use at exit: 345,974 bytes in 28 blocks
==19930==   total heap usage: 10,881 allocs, 10,853 frees, 1,949,970 bytes allocated
==19930== 

comment:3 Changed 4 years ago by rws

It must be decades since I saw such badly formatted code...

comment:4 Changed 4 years ago by dimpase

a quick fix would be to use calloc (which does initialise the memory) for allocating TACKS instead of malloc, and then only call free() on non-null pointers in TACKS[].

comment:5 Changed 4 years ago by rws

Yes, TACKS is not initialized in these cases.

comment:6 Changed 4 years ago by rws

  • Branch set to u/rws/invalid_pointers_in_sympow_on_opensuse

comment:7 Changed 4 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to c9d260f17e397a6edaa339f037442388728f9001
  • Status changed from new to needs_review

New commits:

c9d260f22862: add sympow patch

comment:8 Changed 4 years ago by dimpase

please bump up the package version, i.e. 1.018.1.p11 -> 1.018.1.p12 in package-version.txt.

comment:9 Changed 4 years ago by dimpase

  • Branch changed from u/rws/invalid_pointers_in_sympow_on_opensuse to public/invalid_pointers_in_sympow_on_opensuse
  • Commit changed from c9d260f17e397a6edaa339f037442388728f9001 to d4a673a4d88c9b68c3904517543d753fe7b74399
  • Reviewers set to Dima Pasechnik
  • Status changed from needs_review to positive_review

ok, done


New commits:

d4a673aversion bump

comment:10 Changed 4 years ago by vbraun

  • Branch changed from public/invalid_pointers_in_sympow_on_opensuse to d4a673a4d88c9b68c3904517543d753fe7b74399
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.