Questions tagged [segmentation-fault]
The segmentation-fault tag has no usage guidance.
354
questions
-1
votes
1
answer
47
views
CS50 Pset 4 edges: Why do I keep getting segmentation fault?
Please help me figure out what's wrong! I've been doing this pset for so long now, and I feel like everthing should work, But I just get a seg fault! The code looks like...
void edges(int height, int ...
0
votes
0
answers
13
views
Merge Sort segmentation fault
I am trying to learn how to implement Merge Sort. With the code below, I keep getting a Segmentation Fault. Does anyone know why? Thanks!
// 6/30/23: Segmentation fault (core dumped)?!?!
#include <...
0
votes
1
answer
37
views
Speller Segmentation Fault Even After Freeing Malloc'd Nodes
The following is my code and, subsequently, the message Valgrind returns when I run it on ./speller texts/lalaland.txt.
I explored similar issues previously posted on Stack exchange, and added lines ...
0
votes
1
answer
38
views
Pset 5: Speller - Double free or corruption (fasttop) error
Having to post a new question as the I reworked my code and space restrictions won't allow me to post it in the original thread.
I changed my code based on @CliffB 's suggestion. However, now I am ...
0
votes
1
answer
79
views
Pset 5: Segmentation fault in load function
I am not able to figure out what is causing the segmentation fault in my load function. Valgrind is pointing to fread and the lines where I have 'malloc'-ed memory, but more importantly to the line ...
0
votes
1
answer
22
views
pset5 segmentation faoult
Good morning, I have segmentation fault on my dictionary.c code, I was trying to find a Typ0 mistake or variable declaration mistake but I can not find anyone. Also I can not find logic errors, so I ...
0
votes
1
answer
20
views
Pset5 Speller - trying to understand more about segmentation fault
I tested a piece of code to figure out what's causing the segmentation fault with the 'load' function. The code below opens the large dictionary. Then it scans and prints each string inside the ...
0
votes
0
answers
17
views
Segmentation error in Recover Pset - any clues? A bit stumped
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "check_arguments.h"
#include "jpeg_file_structs_and_operations.h"
#include <stdio.h>
...
0
votes
1
answer
18
views
PSET4 Recover - Why do I get Segmentation Error from Check50
my recover program compiles fine.
When I run the program, I do not get any errors. When I look at the 50 outfiles, I can see the pictures with the image preview.
Valgrind indicates that there are no ...
0
votes
1
answer
33
views
Pset5 speller segmentation fault when loading
When I run speller, I get a segmentation fault. I have played around with the code a little bit and nothing so far has changed. Using help50, this is the result I got:
Looks like you're trying to ...
0
votes
1
answer
34
views
Segfault while declaring 2d array in filter-more's edges function. Probably a lack of memory?
At the very start of the edges function i try to declare an array to hold the image with black borders (now the first comment), but as i've discovered using printfs, it causes a segfault. I searched ...
0
votes
1
answer
102
views
CS50 pset4 recover Segmentation fault (core dumped) problem
I have already solved 2 errors from valgrind but cant solve the last 2 segmentation fault. Also how can i read the valgrind output efficiently. I just got lost between the text.
Thanks beforehand!
#...
0
votes
0
answers
31
views
(pset5)I get a segmentation foult, even though check50 says that everything is allright
as per the title — I get a segfoult and can't check my times, even though check50 claims that the code is practically ready to submit.
Here's my code, followed by valgrind results:
// Implements a ...
0
votes
1
answer
47
views
PSET4 Recover segmentation fault
Good afternoon/morning,
I'm having problem with Problem set 4 Recover,
My code can compile but Segmentation fault (core dumped) keeps going out,
I checked on debug50 and it seems the segfault occurs ...
0
votes
1
answer
16
views
Segmentation fault in pset4 recover when reading file
I tried solving recover.c. But when I tried to run it (without valgrind), I got segmentation fault. When I ran it again with valgrind, it told me that the culprit is in line 40, where I read the file ...
0
votes
1
answer
63
views
Getting segmentation fault when running speller.c
I am trying to solve speller and I always get segmentation fault every time I run it. I checked the error on valgrind and it told me that the culprit is in line 108, where I allocate a new node. How ...
0
votes
1
answer
44
views
pset2 substitution, segmentation fault
So my code for pset2 Substitution works about 99% correctly. When I ran check50, I realized that there is still an issue if the user does not type the key right after the program name at the command ...
0
votes
1
answer
38
views
segmentation fault from pointers
i keep getting segmentation fault when running this code. using printf i can see its from loading ala and the hashtable to store this is set to nil. other words when the hashtable to store them is nil ...
0
votes
1
answer
41
views
segmentation fault with node pointers on speller
I know which line has the segmentation fault ,
if (table[hashn]->next == NULL)
In this case hashn is 0 so its not exceeding the array
Any ideas why its happening?
0
votes
1
answer
156
views
filter-less, reflection, segmentation fault, core dumped, PSET4
dear Friends of CS50X,
I have been working on pset4, filter-less, reflection for several hours now.
I think my code does what it is supposed to do. Also, in my solution I tried to use the concepts ...
0
votes
1
answer
96
views
CS50 PSET 4 RECOVER WORKING BUT NOT PASSING CS50 - SEGMENTATION FAULT
This is for CS50 PSET 4 recover.
I am struggling with identifying the segmentation fault that check50 shows. Upon running, it seems to generate the 50 images correctly without error, and valgrind does ...
0
votes
1
answer
23
views
PSet3 Plurality - Segmentation Fault when exiting main
My code seems to function properly until I try to exit main. At this point it reports a segmentation fault. This only occurs when there is a tie.
Here is my code:
#include <stdio.h>
#include <...
0
votes
1
answer
107
views
readability, cs50 segmentation fault, core dump
Hi, I'm having trouble with this. Is there something wrong with my code line or should i just redo everything?
#include <cs50.h>
#include <stdio.h>
#include <ctype.h>
#include <...
0
votes
1
answer
100
views
pset4 recover error segmentation fault
Can i please get some help with my recover code? i have rewritten it so many times but i still get a segmentation fault
i even unmalloc'd a few things but to no avail
// recovers deleted images
#...
0
votes
1
answer
206
views
pset 2 Segmentation fault (core dumped)
Here is my program caesar, pset 2. I don't know where it is going wrong. whenever I run it with input, Segmentation fault (core dumped) error appears on terminal. how to fix this?
#include <stdio.h&...
0
votes
1
answer
41
views
CS50 pset2 substitution: Segmentation fault in some of "This is CS50" tests
I'm doing Substitution in pset2. My checking result shows that my program has segmentation fault for the last two "This is CS50" tests, as is shown in the pic:
Can somebody tell me why, and ...
0
votes
2
answers
253
views
Segmentation Fault on lab5 Inheritance
I'm trying to do lab5 inheritance. The code compiles and prints the correct output but ends with "Segmentation fault (core dumped)"
debug50 shows a segfault on line 86:
free_family(p->...
0
votes
1
answer
24
views
substitution question segmentation fault issue
I am doing the substitution question and I keep running into this segmentation fault issue but i do not understand what exactly is causing the memory access issue. once j=4, the memory fails to be ...
0
votes
1
answer
102
views
Pset 5 speller: segmentation fault for large dictionary
I can't figure out what I am doing wrong, have gone through many questions and walkthroughs of this problem and it still looks like it should be correct. It obviously is not! With a small and medium ...
0
votes
1
answer
23
views
I have a segmentation fault in Lab5, about free_family function
// Free `p` and all ancestors of `p`.
void free_family(person *p)
{
while (p != NULL)
{
free_family(p->parents[0]);
free_family(p->parents[1]);
free(p);
}
...
0
votes
1
answer
88
views
Caesar problem. Keep getting error of segmentation
The follow part of code worked perfectly, while I declared variables key_num and plaintext within if{}, but since I declared them outside (cause I need to use these vars later) I get the "...
0
votes
2
answers
44
views
Caeser Pset2: Segmentation Fault
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <cs50.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
if ((int)...
0
votes
1
answer
93
views
CS50 PSET4 recover Segmentation Fault
Can someone point out why this code is resulting in segmentation fault?
It's a code for the 'recover' question in pset4, cs50.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h&...
0
votes
1
answer
39
views
Speller still isn't running correctly
I rectified the earlier error in my code (putting dictionary within inverted commas). I also corrected my error in unload where the function would always return false instead of true. However, I ...
0
votes
1
answer
90
views
Segmentation Fault for PSet1 Credit in CS50
first time posting. I swear I looked for answers in other segmentation fault questions already, but I am new to programming and to troubleshooting/researching effectively.
My PSet1 program "...
1
vote
1
answer
57
views
Recover - segmentation fault and other general problems
Hey guys so I've hit a bit of a wall with Recover, when I run my program I get segmentation fault but I also don't know how to end off one jpeg when another header pops up? In essence, I'm not sure ...
0
votes
1
answer
941
views
Inserting node in linked list
I'm attempting to create a linked list in C to practice the concepts of pointers and data structures. I keep running into a segmentation fault and I've narrowed down the issue to my insertNode() ...
0
votes
2
answers
130
views
PSET5 speller segmentation fault
Can anyone help with segmentation fault. I have tried running debug50 and aparently the fault hits at line "if (head -> next != NULL)" in the load function. Aparently "table" is ...
1
vote
2
answers
2k
views
Segmentation Fault on Inheritance, Lab 5
I tried lab4 but I was having issues so I watched Brian's solution walkthrough.
The code compiles and all goes well but when I run the program it shows a segmentation fault.
debug50 shows a segfault ...
0
votes
1
answer
42
views
pset 4 Recover: Segmentation Fault in If-else-statement
I am trying to solve why I get a segmentation fault in my code "recover". It's right at the end of the file. I solved the pset4 by trying different solutions. However, I don't understand why ...
1
vote
3
answers
1k
views
Pset4 recover segmentation fault when running
Finished the problem but when running check50 gets segmentantion faultand running ./recover card.raw .
The error code is the following:
:) recover.c exists.
:) recover.c compiles.
:) handles lack of ...
0
votes
1
answer
325
views
Segmentation fault in blur filter
This is my code for the blur filter in the pset 4.
First I used the average for the corner pixels, then I used a loop for the average of the first and last row and columns and then a nested loop for ...
0
votes
2
answers
147
views
Caesar segmentation fault
I prematurely submitted my code without including the if() statements that check if the second command line argument was a digit (if not it would produce an error message). My code was running ...
0
votes
1
answer
110
views
pset2 substitution Cant figure out the segmentation fault
I've been trying to break it down into parts but I can't figure out why I keep having a segmentation fault. I've watched the lecture but I can't figure out where to put the breakpoint to find it. Im ...
0
votes
1
answer
319
views
PS4 Recover Segmentation Fault (Core Dumped)
Hope you got into the new year well and healthy!
I get a segmentation fault (core dumped) if I want to run ./recover card.raw
Anyone got any tips because I have checked it 100 times already. Valgrind ...
0
votes
1
answer
46
views
PSET2 Getting segmentation error
Hello so I am doing PSET 2 Caesar and I tried to write a function to tell me if argv[1] is not a integer I want it to print the error message from the assignment. The problem is I'm very new with ...
0
votes
1
answer
42
views
Segmentation fault: Pset 2 Caeser isdigit
The log is telling me: "Segmentation fault", and after looking into it, I figured out the problem was in the "isdigit", but i don't know how to fix it, i'm here for about 2 hours ...
0
votes
1
answer
27
views
Program compiles and produces required output in caesar from CS50 but segmentation fault due to lack of memory. What to do next?
My program compiles and produces the required ciphertext in caesar problem but when the input has too many characters, I get a segmentation fault after a specific number of ciphertext characters are ...
0
votes
1
answer
104
views
:( handles lack of key failed to execute program due to segmentation fault
The following piece of code I've written for pset2/caesar produces a "segmentation error" when there is a lack of key (when no command-line argument is provided). I don't know which line or ...
0
votes
1
answer
28
views
Why is it that I keep getting segmentation fault? (Problem set 2 - Caesar)
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int main(int argc, string argv[])
{
if (argc != 2)
{
...