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 ...

1
vote
0answers
30 views

Segmentation fault - reading array of initialized pointers

could you help me with little problem? I have following class; class Link { private: Demand *demand_[NUMBER_OF_CORES][NUMBER_OF_SLICES]; public: Link() { for (int i = 0; i <...
-1
votes
0answers
9 views

segfault errors after running MPI benchmark

Im getting segfault after running MPI benchmark. after compiling I didn't get any errors / warnings. what is this error mean? output: traps: osu_iallgatherv[17786] general protection ip:...
1
vote
3answers
40 views

Segmentation fault while reading a file in C

Good evening! My goal right now is just making something small to read out the characters in a file of any type (and put them into a string for use later in the program) but I keep currently running ...
0
votes
0answers
75 views

C Segmentation Fault(Core Dump) can not figure out why

EDIT: I solved the problem of output file(always case sensitive). But the first problem with segmentation fault is still there. *EDIT 2: So I ran the gdb and this came up * Program received ...
0
votes
0answers
13 views

Segmentation Fault RaspberryPi [on hold]

Version: 7.10.1 Platform: Linux 4.14.52-v7+ armv7l GNU/Linux, Raspberry Pi 3 Model B, Raspbian Lite First of all this is not the latest node, due to dependency compatibility. I have a node program, ...
1
vote
3answers
40 views

Error Reading Variable, Cannot Access Memory

I tried to solve my problem with a precedent topic but couldn't apply to my situation, here is a code for finding the maximum of an array recursively in an array in c. The debug gives the error ...
-2
votes
0answers
47 views

What is the problem with below code it works most of the times but sometimes give segmentation fault error? [on hold]

The program works fine in most cases when used. But sometimes it gives segmentation fault.Trying to find out good practices and how to solve the segmentation fault error and make it work for all cases....
0
votes
0answers
86 views

for loop segmentation fault [on hold]

I'm very new to programming and sorry if I am not asking a question properly on here. Every time after this for loop is done iterating, it gives a segmentation fault. I'm not quite sure what I am ...
0
votes
2answers
40 views

vector.size() is working unexpectedly in comparision

When I use vector.size() in comparisions it gives unexpected results vector<int> v; for(int i = 0; i < v.size() -1;++i){ printf("i = %d\n", i); printf("v[i] = %d\n", v[i]); } since ...
0
votes
2answers
84 views

getting segmentation fault during execution

I am trying to make a tree structure for a specific directory. the path of the directory is entered by the user and is passed to opendir func . the readdir func reads the current directory and is ...
3
votes
1answer
71 views

Code which was built with g++7, crashes with access to unaligned memory

It is strange behaviour when I try to run program, which was built with g++ and optimization -O2. Using: g++-7 (Ubuntu 7.3.0-16ubuntu3) 7.3.0 kernel 4.15.0-36-generic I have structure with two ...
0
votes
1answer
20 views

kernel - postgres segfault error 15 in libc-2.19.so

Yesterday we had crash of PostgreSQL 9.5.14 running on Debian 8 (Linux xxxxxx 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) x86_64 GNU/Linux) - Segmentation fault. Database closed all ...
0
votes
1answer
50 views

Segmentation fault w/ pointer to pointer in different struct in C

I'm trying to create a priority queue linked list, but keep running into segmentation fault. My structure definitions are below typedef struct node { char *new_element; struct node *next; int ...
1
vote
0answers
28 views

Django gives Seg Fault when rendering template, but works with pdb

So I'm working on this webapp, and it was working smoothly until I started adding Translations to it. Now, when I request a specific URL in my template, it gives ERR_EMPTY_RESPONSE in the browser, ...
-3
votes
1answer
53 views

Segmentation fault after entering in a string from struct

so as the question says I get a segmentation fault every time I try to enter in a name for the customer. This program does compile and works until it gets to the customer name part. I'm not sure if ...
-2
votes
0answers
10 views

@php artisan package:discover handling the post-autoload-dump event returned with error 139

This error code results in a Segmentation fault. How do i solve this ? I have tried to figure it out but to no avail. I think it might be due to composer updating certain packages but i'm not sure.
-3
votes
1answer
40 views

SegFault while using std::string::operator+= with function as param

I understand that a Segmentation Fault occurs when there's a problem with insufficiently allocated memory/misdirection by pointers. #include <iostream> using namespace std; const char *hex(...
4
votes
1answer
69 views

C - Segmentation fault with ptrace and waitpid

For a labs school in C, we have to code a process (we are going to call it A) who need to attach to another process (B) and put a trap in a function (trap instruction is 0xCC) so we did it but when B ...
0
votes
0answers
41 views

MPI_Scatter segmentation fault with malloc

Can you explain why this code works perfectly fine: #include <stdio.h> #include <stdlib.h> #include <mpi.h> typedef struct Point { double x; double y; } point; int main(...
0
votes
1answer
28 views

Segfault initializing reference variable on stack in gtest

I'm creating a test for my TwoDArray container and I'm getting a segfault. The TwoDArray object initializes fine on the heap but when I try to test it on the stack, I get a segfault. It uses a vector ...
1
vote
0answers
30 views

X86_64 Assembly code segfaults and gives stack smashing error

So, for this assignment I have to write an Assembly "function" to be called by C code. The purpose of the function is, given an integer and a memory address (the address of a char array, to be used as ...
-3
votes
2answers
67 views

(C) Segmentation Fault/Error (11) ? How do I find the cause?

Are segmentation errors caused by Accessing arrays out of bounds? or is it something to do with accessing pointers? I don't think I have reached outside the array. What could it be? char *files[300][...
-3
votes
1answer
70 views

Receiving Segmentation fault error when running program [closed]

I'm writing this program that needs to read from a file into a class object. Everything compiles, but when i attempt to run the program I receive segmentation fault, but I'm not sure where the error ...
0
votes
1answer
21 views

Assigning instance variance in method leads to segfault

Below is rather basic objective-c code. It contains one instance variable i. The problem is whenever I attempt to assign to it, it leads to segfault almost immediately following that assignment ...
1
vote
1answer
39 views

Why am I getting a segmentation fault with such the limits I have on my while loops?

I'm currently working on a code that must be able to read in a line from a preexisting file line by line, separating different strings in the line with strep(). Currently, it is successfully reading ...
-2
votes
2answers
47 views

Pointer Arithmetic terminates program with Code139 (Segmentation fault) [duplicate]

I wrote a little program to practice pointer arithmetic. If I run it, it terminates with code 139, which is a segmentation fault. I have no idea why the line *name1 = *name2; leads to a segmentation ...
1
vote
1answer
63 views

[C]: Segmentation fault using strcpy() into String Arrays

My assignment is to write a function that takes an input string from a user, tokenize it into several strings each containing an individual word from the input sentence, and then reverses the sentence....
-1
votes
1answer
43 views

Hot to convert TXT File to Array of struct - segmentation fault?

Trying to extract data from a text file and put this data in an array. File contains a certain amount of lines, each one following the same disposition : Number FamilyName FirstName GPA The array ...
-6
votes
1answer
46 views

vector in struct causing Segmentation fault [closed]

I am trying to build a tree with an unknown number of children for each node. To do this, I construct a struct with a vector of child node in it such that I can grow the size of it as I need. The ...
-1
votes
2answers
35 views

(C programming) Segfault when combining 2 one-dimensional array into 1 multi-dimensional array

I am writing a program where I take 2 one dimensional arrays and generate a matrix in its most simplified form Ax=b. This part of the function takes in the arrays A and b. A is A[n*n] and b is b[n]. ...
-1
votes
1answer
14 views

memcpy () : Access violation writing location

I am getting Access violation writing location 0xB7066CBC while running this code.Unable to figure out whats going on, any suggestions? int main(void) { unsigned int SIG = 0x00000000; unsigned int *...
0
votes
0answers
32 views

Optimizing nested while loops in awk to avoid seg faults and core dumping

I am using nested while loops in awk and it is using up large amounts of processing power and in some cases having seg faults and core dumps. An example line of input: 2846196 ...
0
votes
0answers
34 views

read objects from list of Objects

I save objects in a list after creating them, but get a Segmentation fault when I try to read it from this list. When I print the pointers it shows me the same adress as the adress when creating then, ...
2
votes
1answer
42 views

How to fix Segmentation fault while accessing shared library function in C programming?

i created a shared library file named Library.c #include<stdio.h> int Addition(int a, int b) { int s; s = a + b; return s; } debug the share library gcc -shared -o libshared.so ...
0
votes
1answer
51 views

QImage segmentation fault upon scaling

If the window is continuously resized after setImage has been called at least once, the application randomly produces a segmentation fault. The debugger appears to indicate that the offending line is ...
1
vote
0answers
41 views

Segmentation Fault Error When Reading Two Serial Port with BeagleBone Black

I am getting Segmentation fault error while reading two diffentent serial communication line with using Debian GNU/Linux 7.4 on Beaglebone Black. One of them is CAN-BUS data. I am using Waveshares ...
0
votes
2answers
43 views

SIGSEGV, Segmentation fault. while printf() value of index of an array

I want to know how scanf and array works, so i create a code that print the value of each index of an array line-by-line. #include<stdio.h> int main(){ char a[35]; scanf("%30s", a); ...
0
votes
1answer
43 views

Why am I getting a segmentation fault at the end of the function (C)?

I am getting a segmentation fault at the end of readFirst(). If I put in a print statement to check sometimes the print statement doesn't appear. The code compiles, but when I run it, it just prints ...
0
votes
0answers
36 views

Segmentation fault (core dumped) in C in mergesort using pointers and linkedlists

I am having trouble figuring out which line of code produces the segmentation fault (core dumped) error in my code. I am trying to implement mergesort using linkedlists (with pointers). i.e. an in-...
0
votes
0answers
33 views

Getting “Segmentation Fault(core dumped)” on Ubuntu in C for a hash table

I'm trying to implement a hash table in C. I have a csv file, which only consists of a list of surnames on separate lines each. e.g. Sybott O Neill Potter that I am to read from. I then use a hash ...
-2
votes
0answers
21 views

Meaning of Valgrind Warning `Syscall param sched_setaffinity(mask) points to unaddressable byte(s)`

I am debugging a program that occasionally exits due to a signal-11/SegFault. Running the program in valgrind shows no bad memory accesses, but does have the following warning I can't interpret: ...
0
votes
1answer
15 views

Getting signal sigsegv while sorting a linked list

I am trying to sort a linked list,but i getting this segmentation fault while sorting, tried debuggig but cant find the problem though. here is the sorting function: void Asort(struct lol **head_ref)...
0
votes
1answer
29 views

Getting segmentation fault on master/slave

can anyone explain to me why I am getting a segmentation fault on this code? I have been trying to figure it out and have come up empty on various searches. When I run the code without calling main(...
0
votes
1answer
52 views

Segmentation fault (core dumped) error (C) [duplicate]

I've been working on this code for hours but it always gives me error, I don't really know what to do. This code should return a string of 1s and 0s, reading a tree. I'll put in here both code and ...
-1
votes
1answer
69 views

Getting the count of each word in a sorted array

The goal of the following code segment is to take a sorted array of strings, and count how many of each word there is. That information is then put into a struct called reduceNode that holds a ...
0
votes
2answers
68 views

Extracting Wiki links using C

I need to write a program that reads a Wikipedia source file and extracts all the links to other webpages. All the webpages look like example: <a href="/wiki/PageName" title="PageName">Chicken&...
0
votes
3answers
37 views

Printing top 10 recurring words in a file

Edited question: Hi guys, my goal is to print the top 10 occurring words in a file, I have managed to get everything to work from reading the file to counting word occurrences and printing it, but ...
0
votes
1answer
23 views

fread(): Unable to read file for /proc/$pid/status

I am trying to read the file /proc/$pid/status in a function. I am able to open the file using fopen and when I read it using fread() I get Segmentation fault (core dumped). Function: void ...
3
votes
3answers
76 views

Segmentation Fault in C (array related)

I wrote a code in c in order to solve Project Euler Problem 45 (https://projecteuler.net/problem=45). I keep getting segmentation fault error 139. I am sure it is not about trying to access a memory ...
-1
votes
1answer
46 views

C: Segmentation Fault 11 strcpy pointer Array

The code compiles with no errors, but I get a segmentation Fault Error (11), I'm guessing the problem is when I use the strcpy() function in line 82 ,something goes wrong, why im not getting any ...