Changeset b4ecd2 in git


Ignore:
Timestamp:
Jan 21, 2013, 8:20:40 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '45e267b9942dec9429fe249ce3e5e44ab80a6a3a')
Children:
74c52ced49c3c72d9aca4a3cc22f921a3f949687
Parents:
1f1fb0ae2d0228deb0e78489ca037165df05672b
Message:
fix: NULL deref in qideal test

NOTE: adaptation of 071e6adf671c14d7003accadcce5271a90cde970 to SW
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/simpleideals.cc

    r1f1fb0 rb4ecd2  
    7777#endif
    7878
    79 /* index of generator with leading term in ground ring (if any);
    80    otherwise -1 */
     79/// index of generator with leading term in ground ring (if any);
     80/// otherwise -1
    8181int id_PosConstant(ideal id, const ring r)
    8282{
    83   int k;
    84   for (k = IDELEMS(id)-1; k>=0; k--)
    85   {
    86     if (p_LmIsConstantComp(id->m[k], r) == TRUE)
    87       return k;
    88   }
     83  id_Test(id, r);
     84  const int N = IDELEMS(id) - 1;
     85  const poly * m = id->m + N;
     86 
     87  for (int k = N; k >= 0; --k, --m)
     88  {
     89    const poly p = *m;
     90    if (p!=NULL)
     91       if (p_LmIsConstantComp(p, r) == TRUE)
     92         return k;
     93  }
     94   
    8995  return -1;
    9096}
Note: See TracChangeset for help on using the changeset viewer.