You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At first glance it appears the ap->flags |= scan does not need to be predicated on if (scan). After all, scan is initialized to zero and thus merging it into ap->flags does nothing if scan is zero. In actuality the if (scan) should be if (ap). I'm creating this issue to raise awareness that there are too many places in the code with this type of logic error.
The text was updated successfully, but these errors were encountered:
Gah! The issue is that nv_putsub() can invalidate (i.e., free) the structure pointed to by ap. But only if the ARRAY_SCAN bit isn't set. So the code as written is correct if a bit obtuse. This is another manifestation of issue #828. Resizing the actual data array can also cause the structure that manages it to be moved. The sooner #828 is fixed the better.
While working on issue #1038 I came across this block of code:
ast/src/cmd/ksh93/sh/array.c
Lines 1102 to 1108 in cef64df
At first glance it appears the
ap->flags |= scan
does not need to be predicated onif (scan)
. After all,scan
is initialized to zero and thus merging it intoap->flags
does nothing if scan is zero. In actuality theif (scan)
should beif (ap)
. I'm creating this issue to raise awareness that there are too many places in the code with this type of logic error.The text was updated successfully, but these errors were encountered: