Permalink
Browse files

Fixed sigsegv because of 16-byte-misaligned data

  • Loading branch information...
1 parent 1aa5f92 commit 1b330422bd896ab8b9b441508e45ab817b314522 @laurentbartholdi committed Oct 17, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/p1.c
View
@@ -63,14 +63,17 @@ static ldcomplex p1map_eval (int deg, ldcomplex *numer, ldcomplex *denom, p1poin
****************************************************************/
static p1point GET_P1POINT(Obj obj) {
guarantee(IsP1Point, "P1 point", obj);
- return * (p1point *) (ADDR_OBJ(obj)+1);
+ p1point p;
+ memcpy (&p, ADDR_OBJ(obj)+1, sizeof p);
+ return p;
}
static Obj NEW_P1POINT (p1point p)
{
Obj obj = NewBag(T_DATOBJ,sizeof(Obj)+sizeof p);
SET_TYPE_DATOBJ(obj,TYPE_P1POINT);
- * (p1point *) (ADDR_OBJ(obj)+1) = p;
+ memcpy (ADDR_OBJ(obj)+1, &p, sizeof p);
+ __asm__("int3");
return obj;
}

0 comments on commit 1b33042

Please sign in to comment.