[petsc-dev] field split error
Jed Brown
jedbrown at mcs.anl.gov
Sat Sep 28 03:31:46 CDT 2013
"Mark F. Adams" <mfadams at lbl.gov> writes:
>>>
>>> No idea. Do you want me to find out? What should a general IS return
>>> as 'start'?
>>
>> ISStrideGetInfo does not dispatch through dynamically registered functionals.
>>
>> PetscErrorCode ISStrideGetInfo(IS is,PetscInt *first,PetscInt *step)
>> {
>> IS_Stride *sub;
>>
>> PetscFunctionBegin;
>> PetscValidHeaderSpecific(is,IS_CLASSID,1);
>> if (first) PetscValidIntPointer(first,2);
>> if (step) PetscValidIntPointer(step,3);
>>
>> sub = (IS_Stride*)is->data;
>> if (first) *first = sub->first;
>> if (step) *step = sub->step;
>> PetscFunctionReturn(0);
>> }
>>
>
>
> As I said earlier sub->first is 1 for ISGeneral, apparently.
It is an invalid memory access because ISStrideGetInfo casts to an
IS_Stride without checking that the IS type matches. I.e., this is a
serious bug. We normally use dynamically composed functions to make
this safe.
> This is a sort of sensible number.
Nonsense! PETSc and C both use 0-based indexing consistently. This is
not a Fortran interface.
> Is there an enum for 'crazy'? or perhaps I can change sub->first to
> be -1 in ISGeneral and then return an error here if (*first < 0) …
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130928/7f29d69a/attachment.sig>
More information about the petsc-dev
mailing list