[Solved] can not understand this SEGFAULT [closed]

Here is one issue: void WaveTableManager::insert(WaveTable * WT,int position) { if (wtvector.size()<=position) wtvector.resize(position); wtvector[position]=WT; // < — Out of bounds access } When you call resize(), the upper bound is vector::size()-1. Since position is the new size of the vector, what you probably want is this: wtvector[position – 1] = WT; 5 solved can not … Read more

[Solved] My program is executing as expected but in the end I am an extra line called a segmentation fault near the output. Could someone see to it?

You’ve tagged this as c++ but it seems like you’re using entirely c.. So I’ll answer this as if it’s c. A segmentation fault occurs when you access memory that you don’t own. In this case you’re trying to print a character outside of the bounds of your string. (e.g. your string is len characters … Read more

[Solved] Why is this segfaulting? Can someone explain the valgrind error?

Valgrind says that the illegal write is occurring at Address 0x6172676f72502074. If you look at that address as ASCII characters, it’s: argorP t, or converting from little endian: t Progra. This looks like part of one of your menu items, “9. Abort Program”. Maybe the bug is that menu_init() is writing past the end of … Read more

[Solved] Another coredump issue in C

I would think you would need to add check on your externally accepted values (using assert might be a start) Like : checking tm>0 ler>0 C[i]<tm A[i]!=NULL B[i]!=NULL As mentionned in the comment it an off by one issue : in LER the values should be from 0 to tm-1 or use B[i][j]=C[k]-1; at line … Read more

[Solved] char * SEGMENTATION FAULT [closed]

If you are saying that list->at(0) returns NULL Then the pointer pEnd will be NULL. Therefore doing this *pEnd is de-referencing a NULL pointer which will obviously seg fault. If you want to chek for this, you could check the pointer before de-referencing. for eg: if(pEnd == NULL) //Do nothing or throw error or something … Read more