Questions tagged [segmentation-fault]

Segmentation faults occur when accessing memory which does not belong to your process. Use this tag along with a tag indicating the language and a tag indicating the operating system. Segmentation faults are typically the result of a dereference operation with pointer variables (most often containing an invalid address) or a buffer overflow. The root cause for an invalid pointer value may be far from the location generating the segmentation fault.

Filter by
Sorted by
Tagged with
0
votes
1answer
25 views

Class with Struct Inside of it is not Instantiating (Segmentation-Faults Right Away)

What I believe I'm doing is implementing a queue using a circular linked list. It segmentation-faults as soon as I instantiate a Queue object. Researched the issue, but at this point, I've got no idea ...
1
vote
0answers
40 views

Catching segfaults of c++ cli and c++ dlls on a WPF C# application

I have a C# WPF Application running on windows, which utilizes code written in c++ and compiled as dynamic libraries. We have c++-cli code segments for translating data between the C# GUI parts and ...
5
votes
3answers
77 views

Why does freeing the memory lead to segmentation fault?

Im desperate because this code form time to time gives me a segmentation fault and I have no clue why. Actually its only supposed to add some linked list notes, print them and then empty the list by ...
0
votes
0answers
8 views

Segmentation fault (core dumped) with django-storages

I'm using Django 2.x and Django-storages to upload files to the S3 Bucket. While running the sample test from manage.py shell, it gives the following error and terminates the console. Segmentation ...
0
votes
0answers
42 views

Trying to create multiples small multi-dimensional arrays with malloc

I'm trying to allocate two multi-dimensional arrays from a struct with a function. Allocating the first works perfectly but the second fails, even though the code for the two arrays is exactly the ...
0
votes
0answers
30 views

NASM x86 core dump writing on memory [duplicate]

I am learning assembly NASM and trying to do a LFSR code and call it on a C program to evaluate the execution time diference, but failed to figure out the problem with my code. My LFSR C version ...
0
votes
0answers
37 views

can help me in programing c “Segmentation fault” [duplicate]

when i compile the code, the result alwas segmentation fault, how to see the results, i have code : #include <iostream> #include <stdio.h> #include <string.h> using namespace std; ...
1
vote
1answer
29 views

Dynamic Array of Strings Causes Segfault

I wrote some code to create a dynamic array of strings which is automatically resized once full. Even though there seems to be no issue inserting elements in it, I get a segfault when trying to print ...
0
votes
1answer
33 views

How do I solve Segmentation Fault (Core Dump) error in my CPU Scheduling Simulation program in C?

I am very new to C and am getting a Segmentation Error when trying to run the following code (which is a program that originally simulated an FCFS scheduling algorithm, but I had to modify to simulate ...
1
vote
2answers
40 views

passing array address in a function and returninf a pointer

so i am getting some kind of error , that after my array input the code doesnt run . i wanted to see if my method is wrong for inputting an array address in as a function parameter and then using ...
0
votes
2answers
63 views

Getting Segmentation fault while loading OBJ file

I am getting 'Segmentation fault(core dumped)' in C++ using gcc after adding this piece of code to my OpenGL program vector<GLfloat> vecTofloat(vector<glm::vec3> veca){ vector<...
0
votes
1answer
76 views

Segmentation fault with std::uniform_int_distribution

EDIT EDIT: A minimal reproducible example worked fine, in the end, I resolved the problem by carefully rebuilding my program. Doing so, I found a wrong access of an std::vector, which was probably one ...
-1
votes
0answers
24 views

c programming: segfault when allocating memory for an array of struct pointer [duplicate]

I want to allocate memory for an array of struct pointer. The struct contains c-strings My struct looks like this: typedef struct _Data_ { char* dataOne; char* dataTwo; } Data; Next I use a ...
0
votes
1answer
37 views

Assembly ARM - Segmentation Fault

I have changed comments from italian to english. Hope it is more understandable! .data v: .word 1,2,3,4,5,6,7,8 @ at the end I have to get 1,0,3,0,5,0,7,0 ...
-1
votes
0answers
33 views

segmentation fault using conditions in c

We are trying to parse a text file. The problem comes when trying to take into consideration '\n' and '\0'. With one or the other condition it works but not when combining both. THIS IS WORKING: ...
0
votes
1answer
37 views

Segmentation fault when passing a string variable to a function but not when passing a string constant like “hello”

I'm editing a trie program to input my own string into the trie. There is no case of segmentation fault when I pass a constant like "hello" but when I pass a string variable it gets a segmentation ...
0
votes
0answers
42 views

Why does my iterator class housed inside my singly linked list give me a segmentation fault in c++?

all. I'm currently working on my singly linked list and hit a road block with my iterator class. This is so far what I have and I'll start with the node, then the singly linked list, then the ...
-1
votes
0answers
20 views

Why does modifying a node in a tree structure cause a write access violation?

I've been working on a tree data structure for a few hours and I can't get it working. When I try to change any variable in a child node I get thrown a write access violation. I've tried to modify all ...
-2
votes
0answers
42 views

Im encountering a segmentation error for my array's [on hold]

My code starts with taking 4 inputs (mainly from a text file, but I started with user input as a test): both the x and y axis of a circle on a grid, the radius of said circle and a number of points on ...
1
vote
1answer
47 views

c++ Segmentation Fault using struct pointer

I have a class called Dictionary that contains a key-value pair, a pointer to this key-value pair, and an int that holds the size of the dictionary. template<typename K, typename V> class ...
0
votes
1answer
50 views

C++ segfault, reproducible example

Reposting with full code, as suggested from others. Just updated the main function with hard coded arguments that causes segmentation fault. Changing the width and height to something else lets the ...
0
votes
0answers
51 views

vector.push_back segmentation fault, C++ [duplicate]

I've been working on a Sierpinski triangle program which takes in a few command line arguments, two of them being width and height. The program runs fine for some cases of width and height, but other ...
0
votes
0answers
34 views

Can anyone explain why push_back() causes a SEGFAULT here?

I've been getting a segfault and I narrowed down where the issue comes up by simplifying my main() function and using valgrind. main.cpp int main() { unique_ptr<Graph> g1 = make_unique<...
0
votes
2answers
37 views

Getting a segmentation fault when adding a piece of code that is working correctly

I'm new to C, and I have these basic functions, like swap and read_int. Read_int is supposed to receive a char that is in fact a number between 0 and 9, and return its numerical value. Those ...
0
votes
1answer
12 views

Segmentation fault after QLabel.setPixmap with PyQt5

I'm trying to show a PIL image using QPixmap and QLabel. But when I run the code, I get SIGSEGV. Code: import sys from PIL import Image from PIL.ImageQt import ImageQt from PyQt5 import QtWidgets ...
-1
votes
0answers
33 views

Segmentation fault without pointers [duplicate]

I tried compiling my program and running it, but it segfaults on start. The only pointers I have are SDL, and I've been initializing SDL this way for a while without segfaults. What is causing the ...
-2
votes
1answer
49 views

Repeated Segmentation Fault while deleting from a Linked List in C

For an assignment we are told to create a Dictionary Abstract Data Type (ADT) which is based on a linked list structure in C. From all my tests using the required functions size insert (being done ...
0
votes
2answers
41 views

Manupulating and accesing char *s pointer variable (string) using another pointer variable char *c - C

I've hit a roadblock, when trying to manipulate strings when "storing" them as pointer variables. // Sample code to input a string till line break is encountered, later re-allocating to save space ...
1
vote
1answer
15 views

Injecting ServiceEntityRepository results in Segfault / nginx Bad gateway 502

We're currently rewriting our codebase, making this change: // From public function __construct(EntityManager $em){} // then use $this->em->getRepository(Example::class) // To: public function ...
0
votes
1answer
40 views

C++ std::vector iterator acting strange, won't allow incrementation

I'm attempting to use an std::vector in c++, specifically one of type std::string. However, the iterator is acting strangely when I attempt to insert elements into the std::vector and print them out. ...
-3
votes
3answers
84 views

Why do I get segmentation fault if I don't use “new” keyword?

The following code generates segmentation fault. I don't get segmentation fault if I allocate memory on heap for my node1. (Node* node1 = new Node). My question is why do I get segmentation fault now? ...
0
votes
2answers
71 views

Weird C++ linked list bug

I tested this code snippet on different machines with GNU in different versions, only one bizarre Mac with Clang 1001.0.46.3 reports segmentation fault. Is there any address problem or pointer problem ...
0
votes
0answers
9 views

Google Assistant Segmentation Fault Raspberry Pi

$ googlesamples-assistant-hotword --project-id "my project id" --device-model-id "modelId" Segmentation Fault. I even created a new project on google console, enabled the Assistant API, Registered ...
0
votes
1answer
96 views

avoid stack over flow c++

It is a program generated by another system, therefore it could be repetitive and less efficient or intelligent that it should be. The finding is it have a large dependency and fell into a deep ...
0
votes
2answers
66 views

Segmentation fault while calling globfree()

[using arm-hisiv300-linux-gcc to compile for Linux based Target board] I got segmentation fault while I called this function. uint32_t dir_disp(void) { uint32_t err; uint32_t i;...
-2
votes
0answers
22 views

Segmentation Fault (core dumped) by recursive call of readdir(dir) <dirent.h>

I am working on that code that returns a linked list from the listFilesRecursively function to the main() function. And today I was seeking the line where the segmentation fault (core dumped) error ...
0
votes
1answer
39 views

Incurring in segmentation fault problems with doubly linked lists in C

I'm trying to insert nodes at the front of a doubly linked list using a function, but I get a segmentation fault error and just can't understand what the problem is. For the typedefing of the pointers ...
0
votes
3answers
37 views

Why am i getting Segmentation fault(core dumped)

I just started learning trees and want to implement it.this code compiles but after running i get segmentation fault.I have There are 2 functions 1."new" This will create a new node to add to the ...
0
votes
0answers
56 views

Segmentation fault when returning a linked list from a function

I had the following code, which prints the files in a folder that have an ending. It looks also by default files with the following ending "SCL_10m.tif". This is the version that worked so far: #...
3
votes
1answer
76 views

GCC optimizer generating error in nostdlib code

I have the following code: void cp(void *a, const void *b, int n) { for (int i = 0; i < n; ++i) { ((char *) a)[i] = ((const char *) b)[i]; } } void _start(void) { char buf[20];...
0
votes
0answers
20 views

how to resolve error sigsegv in this question?

***SIGSEGV error is coming in my c++ submission code? how to resolve error in my code? In my code i have use bfs to count the level of destination node and then i used dfs to move to that destinaton ...
0
votes
0answers
52 views

How to debug segmantation fault happening on 'stp' instruction in arm binary?

My application randomly and rarely crashes with segmentation fault signal. When coredump is opened in GDB following can be seen: arm instruction leading to crash is: 0x7f8ea08130 fd 7b b7 a9 stp x29,...
2
votes
1answer
43 views

Debugging for hours, segmentation fault. Can't find the issue

Have some code that seems to work but all of a sudden I started getting a segmentation fault every time the code is ran. Hoping a fresh pair of eyes could help me find the problem. It runs this line ...
1
vote
2answers
23 views

Inorder traversal of binary tree gives garbage value and segmentation fault after traversal

I am trying to traverse a binary tree using a stack, the traversal is successful but the program at the end shows garbage values and segmentation fault error. I think it's not going to the top again ...
-1
votes
2answers
64 views

Segmentation Fault When Using The Push Back Function for a Vector

So I am trying to build a hash table with a custom hash function from scratch and I ran into a segmentation fault issue while testing the insert function. If I read the gdb output correctly, the ...
0
votes
4answers
34 views

Trying to get the sum of arrays' element recursively

I'm trying to find the sum of the elements of an array recursively on c++. #include <bits/stdc++.h> using namespace std; int findSum(int arr[], int b, int e) { if(b == e) return ...
-1
votes
0answers
14 views

Segmentation fault with const char*

How can I prevent segmentation fault when using const char*? while( running == 1 ) { SDL_PumpEvents(); const char* keystate = SDL_GetKeyboardState( NULL ); I have also tried: const char* ...
-1
votes
1answer
41 views

Segmentation fault when passing pointer into function [duplicate]

I am trying to pass a pointer into a function so that I can make use of more functions. I have been using the code below and have been getting segmentation errors whenever I run the program. Where do ...
1
vote
1answer
70 views

Why vector cause Segmentation fault Error?

I wanted to make Random number from Openssl. So. I made program : #include "openssl/rand.h" struct randomData { char str[32]; } int main() { std::vector<randomData> vecStr; ...
0
votes
1answer
44 views

I am encountering a segmentation fault in my c code

I am trying to update a 2d array generation by generation. In order to do this, I need to take two arguments: generation number and the initial input txt that contains a 2d array. But no matter what I ...