segmentation-fault

Help track down segfault in "probe" (?) on mingw

Hi! I use MinGW-5.1.6 and MSYS-1.0.11 to build a static libgmp, and then to build some custom libs and programs which use libgmp. Both gmp and the custom things are built using C(XX)FLAGS="-g -ggdb" ./configure. Gmp's make check runs fine. Everything is statically linked (same effect was seen on dynamic linked libgmp). Now when trying ...

Korn Shell SegFault

I have found the following script causes a segmentation fault and core in kshell on AIX. Can anyone explain why I get the following results? Seg Fault doOutput(){ Echo "Something" } doOutput() >&1 OR doOutput(){ Echo "Something" } echo `doOutput()` No Output doOutput(){ Echo "Something" } doOutput() Correct doOutp...

Bus Error Upon Calling Delete (C++)

I've been creating a class that takes a bunch of images and overlays them onto one BMP. For some reason upon running the code I'm getting a segfault and I've tracked it down to this method. Essentially the if statement checks to see if there is a valid index in the array of images to place this new image in. If it is valid then it del...

Segfault Copy Constructor

My code is as follows: void Scene::copy(Scene const & source) { maxnum=source.maxnum; imagelist = new Image*[maxnum]; for(int i=0; i<maxnum; i++) { if(source.imagelist[i] != NULL) { imagelist[i] = new Image; imagelist[i]->xcoord = source.imagelist[i]->xcoord; imagelist[i]->ycoord = source.imagelist[i]->ycoord; ...

Can someone tell me why my code generates a segmentation on SPOJ? and what is the segmentation fault error ?(FCTRL2 problem)

#include<stdio.h> #include<iostream> #include<string> #include<string.h> using namespace std; char arr[200],res[200]; char table[150][200]; string multiply(char n[],int m) { int N=strlen(n),M,temp=0,x=0; for(int i=0;i<N;i++) arr[i]=n[N-1-i]; for(int i=0;i<N;i++) { x=m*(arr[i]-'0')+temp; x=m*(arr[i]...

glibc detected error

Hey, Can anybody please help me make sense of this error message? *** glibc detected *** ./kprank_new3_norm: munmap_chunk(): invalid pointer: 0x00000000096912d0 *** ======= Backtrace: ========= /lib64/libc.so.6(cfree+0x1b6)[0x3df6e75a36] ./kprank_new3_norm[0x409277] ./kprank_new3_norm[0x4092a9] ./kprank_new3_norm[0x4092ea] ./kprank_new3...

wcstombs segmentation fault

Hello, this code int main (void) { int i; char pmbbuf[4]; wchar_t *pwchello = L"1234567890123456789012345678901234567890"; i = wcstombs (pmbbuf, pwchello, wcslen(pwchello)* MB_CUR_MAX + 1); printf("%d\n", MB_CUR_MAX); printf (" Characters converted: %u\n", i); printf (" Multibyte character: %s\n\n", pmbbuf); ...

Debugging PHP Memory Corruption with Valgrind

Hi. I'm encountering what seems to be a memory corruption issue with PHP. I have a large code base that I am porting to the 5.3 runtime. I get segfaults and "zend_mm_heap corrupted" errors, but the backtraces from those points are not useful. The backtraces always lead back to various core PHP functions such as variable assignment or co...

Writing to a character array that is a member of a struct

Hello, this is my first time posting a question here - I've searched for ones that are similar, but none came up that I found. Here is the snippet from my header: #define LINE_LEN_MAX 256 typedef struct line_description { char buffer[LINE_LEN_MAX + 1]; [...] } line; And here is the snippet from my main function: int main(in...

Troubleshooting segmentation Fault

I am getting a segmentation fault in some C code, and I cannot figure out how to read this so I can figure out the problem.. Does anyone have any techniques that can help me? Does anything jump out to you? Here is gdb output: GNU gdb 6.8 for GNAT Pro 6.2.1 (20090115) [rev:143235] Copyright (C) 2008 Free Software Foundation, Inc. Lic...

What is causing a segmentation fault?

I have been attempting to write a program that will determine if a number is prime or not. I have based it off of the Sieve of Eratosthenes. Anyway, my program works for small numbers (15485863 works), but if I use large numbers (ex. 17485863) I receive a segmentation fault. I am using unsigned long longs and do not think I have surpasse...

Help with segmentation fault in function

I've been trying to solve this bsearch homework problem for awhile now. I try using my code to first search for one entry like so: int Compare(const void *a, const void *b); void SortStudents(char *studentList[], size_t studentCount) { qsort(studentList, studentCount, sizeof(studentList[0]), Compare); } int Compare(const void *a...

Segmentation fault after free(), what are the common causes for this?

I get a segmentation fault after freeing a certain pointer: free(studentDB->name); I can get its value without any errors or warnings: printf("[DBG] studentDB->name: %s\n", studentDB->name); However, as I said, the program crashes when I try to free it. What are the most common causes for a free command leading to a segmentation fa...

C++ libpthread program segfaults for unknown reason

Hi I have a libpthread linked application. The core of the application are two FIFOs shared by four threads ( two threads per one FIFO that is ;). The FIFO class is synchronized using pthread mutexes and it stores pointers to big classes ( containing buffers of about 4kb size ) allocated inside static memory using overloaded new and del...

Problem with boost::variant, linker giving a segfault

I have a boost variant with 7 types in it. When I try to use the last two types, the linker segfaults. I am using g++ (gcc version 3.3.3 on SuSE Linux) on a 64 bit linux machine and the error that I get is collect2: ld terminated with signal 11 [Segmentation fault] It doesnt matter what order I put the types in, the last two will cau...

Does Snow Leopard put core dumps somewhere special?

I'm trying to debug a segfault on an application I'm working on (works on linux of course, so I can't use that as my fallback for debugging core dumps). Anyhow, I've set "ulimit -c unlimited" and snow leopard reports "Segmentation fault (core dumped)" but alas there is no core file to be found. Does Snow Leopard put them somewhere spe...

Check for stdout or stderr

Hello folks, One of the binaries which I am using in my shell script is causing a segmentation fault (RETURN VALUE: 139) And even though, I am redirecting both stdout and stderr to a logfile, the Segmentation Fault error messages is displayed in the terminal when I am running the shell script. Is it possible to redirect this message ...

Symfony Doctrine Schema Segmentation Fault

Hi All, I'm setting up my first symfony project, and am having trouble with the schema. I'm not sure if I'm going about it the right way. I'm having a problem with two of my classes. I have Clients, which can have many Contacts, one of the contacts needs to be selected as the invoice contact. This is my schema: NativeClient: actAs: ...

What is segmentation fault?

What is segmentation fault? Is it different in C and C++? How are segmentation fault and dangling pointer related? ...

How to catch segmentation fault in Linux?

I need to catch segmentation fault in third party library cleanup operations. This happens sometimes just before my program exits, and I cannot fix the real reason of this. In Windows programming I could do this with __try - __catch. Is there cross-platform or platform-specific way to do the same? I need this in Linux, gcc. ...