On Mon, 23 Aug 2021 21:06:05 +0200, sujith kumar reddy wrote: > > Hi Folkert, > > Tried with the above code.This is also getting p value negative. > > My point is p is negative it doesn't go to > > if (p >= bar_length) > p = bar_length - 1; > it is going to memset second argument p,that is negative so crashing. Gah, the code there contains lots of craps. A negative value must not have been passed there. Below is a series of fixes. Please give it a try. thanks, Takashi