Skip to content

Commit 540c4c8

Browse files
committed
fix bad string pointers (#46)
1 parent abe5db5 commit 540c4c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cypari2/gen.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ cdef class Gen(Gen_auto):
16171617
lx = lgefint(x) - 2 # number of words
16181618
size = lx * 4 * sizeof(long)
16191619
s = <char *>check_malloc(size+3) # 1 char for sign, 1 char for 0, 1 char for '\0'
1620-
sp = s + size + 3
1620+
sp = s + size + 3 - 1 # last character
16211621
sp[0] = 0
16221622
xp = int_LSW(x)
16231623
for i from 0 <= i < lx:
@@ -1660,7 +1660,7 @@ cdef class Gen(Gen_auto):
16601660
lx = lgefint(x) - 2 # number of words
16611661
size = lx*2*sizeof(long)
16621662
s = <char *>check_malloc(size+4) # 1 char for sign, 2 chars for 0x, 1 char for '\0'
1663-
sp = s + size + 4
1663+
sp = s + size + 4 - 1 # last character
16641664
sp[0] = 0
16651665
xp = int_LSW(x)
16661666
for i from 0 <= i < lx:

0 commit comments

Comments
 (0)