segmentation-fault

segmentation fault in findContours

为君一笑 提交于 2019-12-25 07:05:26
问题 I am getting segmentation fault error during run time for the below code to find contours. I have referred this post on this form but didn't help me much. I got to know there are some issues with findContours This is another issue of findContours. Please check both the links and help me to resolve this error. I don't know why I am getting segmentation fault error. #include "opencv2/objdetect/objdetect.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include

strtok() - Segmentation Fault [duplicate]

我的梦境 提交于 2019-12-25 06:38:44
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: strtok giving Segmentation Fault I try to use strtok function to split string in many tokens but in this example it returns me a seg. fault error. Where i'm in wrong?? #include <stdio.h> #include <string.h> int main(int argc, char** argv){ int i=0; char * string = "HI:HOW:ARE:YOU:?", *tmp; while(1){ if(i==0) tmp=strtok(string,":"); else tmp=strtok(NULL,":"); if(tmp==NULL) break; printf("%s\n",tmp); i++; } return

Segmentation Fault Strongly Because of Heap/Stack Corruption

ε祈祈猫儿з 提交于 2019-12-25 05:12:05
问题 #include <stdio.h> #include <dirent.h> #include <sys/types.h> #include <sys/param.h> #include <sys/stat.h> #include <unistd.h> #include <string.h> #include <string> #include <stdlib.h> #include <limits.h> #include <list> #include <math.h> #include <vector> #include <iostream> using namespace std; enum ElementType { NONE,SIMPLEFILE, DIRECTORY, SYMBOLICLINK }; class Element{ public: Element():exists(false){ name=std::string(""); full_path_name=std::string("");; element_type=NONE; element_size=0

Segmentation Fault Strongly Because of Heap/Stack Corruption

﹥>﹥吖頭↗ 提交于 2019-12-25 05:12:04
问题 #include <stdio.h> #include <dirent.h> #include <sys/types.h> #include <sys/param.h> #include <sys/stat.h> #include <unistd.h> #include <string.h> #include <string> #include <stdlib.h> #include <limits.h> #include <list> #include <math.h> #include <vector> #include <iostream> using namespace std; enum ElementType { NONE,SIMPLEFILE, DIRECTORY, SYMBOLICLINK }; class Element{ public: Element():exists(false){ name=std::string(""); full_path_name=std::string("");; element_type=NONE; element_size=0

Getting segmentation fault strcpy [duplicate]

痞子三分冷 提交于 2019-12-25 05:11:14
问题 This question already has answers here : Segmentation Fault in strcpy() (3 answers) Closed 4 years ago . struct Object * newObj(char * nome, int idade, float altura) { struct Object *obj = (struct Object *) malloc(sizeof(struct Object)); strcpy(obj->nome, nome); // This is the line obj->idade = idade; obj->altura = altura; return obj; } This is my code, I don't know why I'm getting segmentation fault in strcpy. Any ideas? Thanks in advance. 回答1: In your struct Object type, the nome member is

Proc crashes even if it allocates less memory than limited by ulimit

谁说胖子不能爱 提交于 2019-12-25 04:39:21
问题 I have set stack size to 2000Kb by ulimit -s 2000 and ulimit -Ss 2000 for hard limit. And in the below program i have allocated appox 2040000(510000 x 4) bytes which is less than i limited i.e,. 2048000(2000*4)bytes but i see that my program crashes! Can anybody suggest why this happens. #include <stdio.h> #include <malloc.h> int main() { int a[510000] = {0}; a[510000] = 1; printf("%d", a[510000]); fflush(stdout); sleep(70); } EDIT 1: Crash is not because of the array index out of bound as i

Segmentation Fault While Sorting

♀尐吖头ヾ 提交于 2019-12-25 04:33:37
问题 I have implemented quick-sort.But this code is giving me segmentation fault. #include<stdio.h> #include<stdlib.h> void Quick_Sort(int *a,int p,int r); int partition(int *a,int p,int r); int main(){ int testcase,num,search; int i,j,*array; scanf("%d",&testcase); for(i=0;i<testcase;i++){ scanf("%d",&num); array=malloc(sizeof(int)*num); for(j=0;j<num;j++){ scanf("%d",(array+j)); } Quick_Sort(array,0,num-1); scanf("%d",&search); /*for(j=0;j<num;j++){ if(search==*(array+j)){ printf("%d\n",j+1 );

__do_global_ctors segfault somewhere in project, cant locate it

这一生的挚爱 提交于 2019-12-25 02:47:37
问题 I migrated a project from Qt4 to Qt5, and it compiles and everything but the application crashes before it even reaches the main function. I know there is a null value that fucks up something at some point, maybe a file that cant find or something, but there are so many .cpps and .h and libraries that its pretty hard to locate the source of the error plus I cant set any breakpoints. I have a lot of debugging data so maybe any of you can guide me in the right direction. I dont know what I

segmentation fault (core dump) while loading a file [duplicate]

假如想象 提交于 2019-12-25 02:47:36
问题 This question already has an answer here : Core dump while loading a file (1 answer) Closed 6 months ago . I am trying to create a function which loads data from a .txt file but when it runs I always get a segmentation fault(core dumped) error. The file contains an unknown number of lines while each line has a string and an integer separated by tab.The list_create function just creates a data structure. The while loop in the end deletes the data structure, I did not include the code because I

Segmentation fault on closing a binary file

倖福魔咒の 提交于 2019-12-25 02:40:13
问题 The part of the code which gives rise to the segmentation fault is given below. ifstream xiFileId(xifile, ios::binary); //xifile is a char * //the ii_t class in the following line is taken from http://stackoverflow.com/questions/1855704/c-binary-file-i-o-to-from-containers-other-than-char-using-stl-algorithms written by http://stackoverflow.com/users/14065/loki-astari ii_t<uint> xi_in(xiFileId); copy(xi_in, ii_t<uint>(), xi.data()); //xi is a 2D boost::multi_array //my efforts to debug ios: