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.
11,831
questions
0
votes
0answers
16 views
imac freezes after running program
I am doing work with the training graphics library mlx. While testing the library, I ran into the problem that this code is causing my imac mojave to freeze. Only reboot helps. What's wrong?
My code
#...
-2
votes
1answer
38 views
Segmentation fault for sorted linked list
I'm trying to insert a node then sort it into a sorted linked list, but I keep getting a segmentation fault. However, I don't really see where I went wrong: insertNode is library function, so I don't ...
0
votes
0answers
107 views
custom setjmp/longjmp implemetation segmentation fault
I'm trying to implement custom setjmp/longjmp for x64 windows.
I have following code:
contextSave:
xorq %rdx,%rdx
movq %rdx,(%rcx)
movq %rbx,0x8(%rcx)
leaq 0x8(%rsp),%rax
movq %rax,0x10(%rcx) ...
0
votes
1answer
3k views
strtok() - Segmentation Fault [duplicate]
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??
#...
0
votes
1answer
25 views
Proper use of `nalu_process` callback in x264
I wish to make use of libx264's low-latency encoding mechanism, whereby a user-provided callback is called as soon as a single NAL unit is available instead of having to wait for a whole frame to be ...
0
votes
1answer
9 views
memmove implementation throws segmentation fault while copying a character array
Hi I tried to write my own version of memmove and I find the following code resulting in a segmentation fault. It would be great if someone could help me figure out why this behavior would occur!
...
1
vote
1answer
18 views
I simplified a part of my project to solve this specific problem I have (invalid write of size 4/segmentation fault)
A step by step compiler says "Invalid write of size 4", while in general it's a segmentation fault. I don't understand how to solve this. I have been fidgeting with this for the past few ...
0
votes
1answer
27 views
Message queue stack smashing
I'm trying to implement a message queue and I have named the one process server and the other one client (as you can see I wanted to stick with the conventional names). The is a piece of code above ...
0
votes
0answers
36 views
C - Segfault attempting to get the value of a node in a doubly linked list
I am attempting to write a doubly linked list containing "Person" structs, but my main program crashes during the "Get" function to return a Person from the list
Here's the list ...
-1
votes
0answers
49 views
Segmentation fault while blurring an image with cuda
As the title, i'm trying to blur an image using cuda and lodepng as library to load the image. This is the code
#include "lodepng.h"
#include <iostream>
#define BLUR_SIZE 1
std::...
1
vote
1answer
5k views
Segmentation fault: 1902 vfscanf.c: No such file or directory
The program stops with segmentation fault at scanf() function.
This is simplified code:
int main() {
int x = 0;
printf("$ ");
scanf("%i", x);
return 0;
}
And when I run ...
0
votes
1answer
29 views
Segmentation Default
Creation of node:
struct Node
{
int data;
struct Node *link;
};
struct Node *head = NULL;
Append Function
int append()
{
struct Node *temp;
struct Node *p;
temp = (struct Node *)...
0
votes
1answer
38 views
SegFault when passing two pointer parameter in a function in C
I'm using GCC Compiler 9.3.0 on GNU/Linux Environmental, using C17.
I have to remove the code since I can't show that to everyone, please understand.
If I remove largest_lowest call from main ...
2
votes
3answers
4k views
Assembly NASM Segmentation Fault, what does it mean?
when I assembly the following assembly code I get the error Segmentation fault (core dumped)
section .text
global _start
_start:
mov eax, 8
My Makefile is as follows
all:
nasm -f elf64 -o ...
2
votes
1answer
57 views
Understanding stack overflow handling in C
I was curious about how to catch stack overflows in C and stumble across the GNU libsigseg library.
This library can catch stack overflows on a lot of platforms and provides an implementation example.
...
-1
votes
3answers
54 views
Segmentation fault: but why?
#include <stdio.h>
int main()
{
int* ptr;
*ptr = 5;
printf("%d", &ptr);
return 0;
}
This was asked in a coding interview, what should be the output?
I am confused between ...
0
votes
1answer
10 views
Pre increment operator and dereference operator resulting in segmentation fault, can't seem to understand why
Found the following piece of code given in a test which asked to figure out the output.
#include <stdio.h>
int gate(char *P)
{
char *q = P;
q++;
*q++;
++*q;
return(q-P);
}
...
0
votes
0answers
11 views
Buffer Overflow Exploit - Getting Segmentation Fault
I am trying this code for Buffer Overflow Exploit. I compiled the code using gcc for 64 bit, disabled ASLR and allowed stack-smashing. I am not very good at reading assembly code but what I understood ...
1
vote
1answer
36 views
SIGSEGV assigning an object to a dynamic 2d matrix
I'm trying to simply assign an element typedefined as Card from a vector to mtr[i][j], a 2d matrix stored in heap, but the debugger claims a segmentation fault.
I think I tried everything, trying with ...
0
votes
0answers
24 views
Why memcpy(NULL, NULL, 42) does not segv? [duplicate]
When I using memcpy with one null and len(len > 0), It returns segv. But with both null, it doesn't return segv. Even with length. Why is it happening?
-1
votes
1answer
29 views
Why does the hash function give a segmentation fault?
I was trying to make a spell checker program where I first have to load a dictionary into memory. To do so, I tried using a hash table. The program shows a segmentation fault when I use the hash ...
0
votes
1answer
28 views
How to print a unsigned char array from a pointer of a structure?
I'm trying to call a function via function parameter. The function I'm trying to call takes a structure as a parameter. I'm able to call the desired function but while trying to print an unsinged char ...
-2
votes
0answers
22 views
Segmentation fault when accessing an array of pointers [closed]
So, I'm trying to read in a dat file. create a Customer object that I made, and put it into a dynamic array of pointers. When I try to print out what is in the array, I get a segmentation fault ...
-1
votes
1answer
29 views
wxStaticText::SetLabel() segmentation fault
I'm new to wxWidgets and I wanted to make a simple GUI application (on ubuntu) for reference.
I created a simple window, added some buttons and in a button event handler I want to update a ...
-2
votes
0answers
18 views
Segfault when calling boost::property tree get function,code works with -O0 but crashes with -O2 optimization [closed]
property tree is loaded in a package A, but used in both package B and A. In package B segfault takes place when propertytree.get("Path", default value) is called inside the boost code.
...
0
votes
0answers
34 views
why do i get Segmentation fault (core dumped) error here?
while trying to regenerate the function strrchr i get this error, can someone help me understand this part?
#include <stdio.h>
char *ft_strrchr(const char *s, int c)
{
int i;
char *ptr;
...
42
votes
9answers
75k views
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
I'm trying to execute a Python script, but I am getting the following error:
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
I'm using python 3.5.2 on a Linux Mint 18.1 ...
1
vote
1answer
60 views
segmentation fault while calling a function
I have this function where after a while of execution there occurs a segmentation fault which seems to be occuring due to a function call inside it.
void dfs(struct node* gptr,int start)
{
// ...
0
votes
2answers
1k views
Segmentation fault on strncat()
First, I write a simple program.
1 #include <string.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 int main()
6 {
7 char *buf = (char*)malloc(sizeof(char)*2000);...
0
votes
0answers
23 views
Keep getting segmentation fault while trying to write a program that breaks down a file into multiple JPGs
As the title says, I've been trying to write a program in C that turns a file into multiple JPGs for a CS exercise. I've closed and freed everything I've worked with, but I'm still getting a ...
1
vote
0answers
21 views
Blender multi-threading
I am trying to create a simple project in which the position of a certain object is updated in a specific thread while in the others data are received from an UDP client. But now, for simplicity, I am ...
0
votes
1answer
40 views
Java SIGSEGV error when running from docker
I have no experience in Java and I can run my code successfully from the development. But only when I built the project and runs it from docker, I got an error like this.
#
# A fatal error has been ...
2
votes
2answers
64 views
segfault when referenced by index
The convert_list_toarr function takes a linked list as an argument. Next, it convert the linked list into array. Next, using print_matrix, I want to print the array to the console.
I get a segfault in ...
0
votes
0answers
34 views
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)-android 10 (API 29) mostly
I am getting signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const
on android vitals crashes more than 3500K user impacted ...
0
votes
1answer
40 views
Erasing from a vector, passed by reference
I'm attempting to erase elements from a vector, by index, which has been passed by reference to some function. Typically, I'd do so like this:
void erase_element(vector<int> &my_vector, int ...
0
votes
0answers
39 views
How can I properly decompress memory sent by the server
I am writing a multiplayer voxel game. I am trying to compress the world on the server, send it over to the clients, and decompress it back on the client side. The problem is that I am getting a ...
3
votes
0answers
113 views
Mysterious Signal 11 crash when accessing Room database
About
I have an android application, which has 2 activities. Activity A spawns Activity B, and Activity B accesses Room Database in another module. I'm using Koin for all dependency injections, and ...
1
vote
1answer
56 views
AWS Lambda Chalice Layers Segmentation Fault
I am deploying a Python 3.7 Lambda function via Chalice. Because the code with its environment requirements, is larger than 50 MB limit, I am using the "automatic_layer" feature of Chalice ...
1
vote
0answers
49 views
Memory leak after shrinkage with realloc
I don't know, what has happened to the formatting, but I can't mark selected chunks as code with Ctrl+K. SORRY FOR THAT
I use gcc with flags as a compiler and run valgrind with:
valgrind --leak-check=...
-1
votes
1answer
33 views
Allocating memory and freeing correctly?
This is the code for allocating memory for 2 Arrays of uknown size. N is given by the user:
K=malloc(N*sizeof(int));
if(K==NULL){
// printf("Sorry, cannot allocate memory\n");
return -...
0
votes
0answers
95 views
Using FFmpeg with URL input causes SIGSEGV in AWS Lambda (Python runtime)
I'm trying to implement a video converting solution on AWS Lambda following their article named Processing user-generated content using AWS Lambda and FFmpeg.
However when I run my command with ...
0
votes
1answer
43 views
method giving app crashes due to segmentation fault in c++
this simple loop method is unable to run and an error arises "app crashed". when i checked this in an online compiler it gave 'segmentation fault(core dumped)'-
string studies(setMatter ch) {...
2
votes
1answer
77 views
Why this code is working fine at leetcode but giving segmentation fault at geeksforgeeks?
gfg https://practice.geeksforgeeks.org/problems/subset-sum-problem2014/1
leetcode
https://leetcode.com/problems/partition-equal-subset-sum/
Problem:
Given an array arr[] of size N, check if it can be ...
3
votes
2answers
175 views
atom libc-2.31.so segfault in ubuntu 18.04
atom worked smoothly in my Dell Latitude 5410 running Ubuntu 18.04. Suddenly it won't open and looking at tail -F /var/log/syslog I got a libc-2.31.so segfault:
Jan 15 03:22:17 enrico-dell-latitude-...
-1
votes
0answers
30 views
assembly segmentation fault in basic program
The program listed below throws a segmentation fault for 3 as entered number, I am unsure whether my use of [num] is correct. I assumed
mov [num],eax moves the contents of eax to the memory location ...
0
votes
2answers
48 views
Suspending threads of thread pool in C
I am working on a project based on parallel programming, where I need to execute a given task as efficiently as possible (in terms of time and energy consumption).
For this I need to suspend some ...
0
votes
2answers
40 views
scanf is getting skipped, showing segmentation fault [duplicate]
This code says segmentation fault cause the program's scanf isn't working. I used a debugger to find out this. The scanf(num) is skipped. And thus the segmentation fault. Can somebody tell why the ...
0
votes
1answer
53 views
Understanding the reason of segmentation fault in code snippet below [closed]
I am trying to find out the longest peak length in an array.
Example:
Array: [1, 2, 3, 2, 1, 1]
Peak Length: 5 (1,2,3,2,1)
I have used the following code to find out the longest peak in an array:
...
2
votes
2answers
85 views
Why “mov %%rsp, %%rbp” causing Segmentation fault?
I'm new in inline assembly. I have the following C function with inline assembly. I'm just trying to see if push %%rbp and mov %%rsp, %%rbp actually operating correctly. My function is following,
...
0
votes
0answers
62 views
Pygame: Segmentation fault when attempting pixel perfect collision and image modification [duplicate]
I keep getting segmentation faults or crashes when I move my sprite to the right side of the screen.
I am attempting to get my "sprite" to "switch" pixels with another image I have at the point of ...