Questions tagged [segfault]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
55 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 ...
Soumik's user avatar
  • 15
0 votes
1 answer
46 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 ...
Eva Chen's user avatar
0 votes
2 answers
238 views

speller seg fault

I have been on this for literal days, there is always a seg fault no matter what i do things i have tried: debug 50: MULTIPLE TIMES, i fix the errors i find but end up with another one soon after, ...
jeddah's user avatar
  • 5
0 votes
1 answer
44 views

Getting a segmentation fault on cs50's speller (pset5)

I would love a bit of help on cs50's pset5 speller. The program does compile. However, when I run valgrind ./speller texts/cat.txt I get a segmentation fault . I think I am overlooking something but I ...
Hamster1303's user avatar
0 votes
1 answer
31 views

Pset5 - Speller - Seg fault

I'm getting a segmentation fault when running this. Valgrind reports no errors, but a leak of 1,080 bytes at two blocks, with 5 allocs and only 3 free'd. Below is my load function and below that are ...
nicolasalouf's user avatar
0 votes
1 answer
46 views

The third last line of code is the one causing a segmentation fault. When removed, nothing happens and all I get is a $ on a new line in the terminal

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <cs50.h> int main(int argc, char *argv[]) { #define BUFFER_SIZE 512 FILE *img = NULL; if(argc =...
Lim Yee Wee's user avatar
0 votes
1 answer
52 views

Word array sometimes filled with weird values - Speller

My code looks like this: (ignore the comments; they're old) // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include "dictionary.h" #include &...
dillon__nguyen's user avatar
0 votes
1 answer
77 views

Trying to fix a segfault in unload , pset5, speller

So when I originally wrote my code for the dictionary.c, I forgot to create the header nodes for each 'bucket' in the hash table. It ran well when every first node of each linked list had a letter, ...
Ruben Alias's user avatar
1 vote
1 answer
401 views

Segmentation fault with overwriting chars

I tried overwriting cipupperalphabet[j] from a A to a B, but it has caused a segmentation fault. string upperalphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string cipupperalphabet = upperalphabet; int j = ...
xander's user avatar
  • 11
0 votes
1 answer
75 views

PSET 5 Unload Segmentation Fault

I've been stuck on this problem set for a while now. Valgrind is telling me I have a problem in my unload function, which is "Conditional jump or move depends on uninitialised value(s)". I can't find ...
mkg15's user avatar
  • 67
0 votes
1 answer
30 views

Pset5 Seg fault speller

I´ve been stuck in pset5 for a little while. I was wondering if someone would be able to take a loot at it? Fow now all my hash function does is look at the first letter of a word. I will of course ...
HumbleCauchyServant's user avatar
0 votes
0 answers
43 views

Pset4 Recover segmentation error

Help needed with recover part of pset4. Please find my code below. It compiles but produces a seg fault. Any comments are welcome. Thanks in advance. #include <stdio.h> #include <stdlib.h&...
DevelopWithAP's user avatar
1 vote
2 answers
134 views

CS50 PSET4 RECOVER.C SEGMENTATION FAULT PLEASE HELP!

I'm seriously struggling with this assignment and I can't seem to find the problem in my code. I'm supposed to create a program that reads a raw card one block at a time with each block containing ...
Ewan's user avatar
  • 11
8 votes
2 answers
2k views

Do YOU know how to find a seg fault?? Advice to new programmers [closed]

I have noticed a rash of questions lately that are essentially this: "My code has a segmentation fault. The code compiles, many tests pass, but I can't figure out the problem!" If this is ...
Cliff B's user avatar
  • 68.1k
0 votes
1 answer
152 views

Pset 5 Speller Segmentation Fault

Seg-faults seem to be the bane of my existence. I've tried running valgrind and using printf functions to find the line(s) of code that are causing the seg-fault in my implementation of speller, but ...
tahahasan360's user avatar
0 votes
1 answer
45 views

Pset5 Trie Segmentation fault

Have been trying to debug this for days and eventually came down to the following problem: When running an example test(lalaland.txt) the misspelled words are fine up until the program abruptly stops(...
IVO PETROV's user avatar
0 votes
2 answers
190 views

Cant create linked list node

For speller (hash table implementation) i keep getting a segfault that is coming from the line in this code where i set node->next = NULL struct node* createNode(char word[]) { node *node = ...
CSumter's user avatar
0 votes
1 answer
35 views

Segfault error in initials program

//when ever it calls the hasLast function with only one name entered as an input it crashes with a seg fault for the initials more problem #include <stdio.h> #include <string.h> #include &...
Evren Cetin's user avatar
0 votes
1 answer
88 views

PSET5: load fails with large dictionary, but works with small dictionary - trie

I'm trying to use a trie structure to implement the load function in speller. I get a segmentation fault with the large dictionary, but not the small one. Text file size does not seem to matter, (I ...
brand n00bian's user avatar
0 votes
1 answer
82 views

Pset5: load hashtable - constantly giving seg fault

I'm trying to load my dictionary into memory in order to program my spellchecker. While compiling "speller.c" works fine, my execution ./speller returns a seg fault and I just can't seem to get the ...
Kai.k's user avatar
  • 3
0 votes
1 answer
468 views

SEGMENTATION FAULT : Week 4- shorts-Recursion - Collatz conjecture

I can't understand why my program is facing a segmentation fault. I decided to make my own program which counts the number of steps used in Collatz Conjecture(as discussed in week 4). The picture ...
SlashVaish's user avatar
0 votes
1 answer
30 views

No errors while loading small dict, but segfault when loading large one. Pset5 Speller

Getting a segfault after about 75 words added to the dictionary. #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include "dictionary.h" typedef struct node { ...
Semyon Kamoza's user avatar
0 votes
1 answer
113 views

PSET5: Hash function and code not handling possessives and substrings

I am having a lot of problems with pset5. I have identified more than one issue with the code but I don’t know how to fix the issues. The first is from my hash function, which is featured below and I ...
Marney Doran's user avatar
1 vote
2 answers
140 views

Crack: Segfault on CS50 appliance/ IDE/ CS50.io but fine on my computer

I'm trying to make PSET2 crack, however in online IDE I got segmentation fault. I tried same thing on my local computer and it works fine. What's wrong? Pls ignore the fact that code is ugly etc. ...
J Doe CS50's user avatar
0 votes
1 answer
58 views

PSET6 Load - Check50 Server2 Errors

Check50 Server2 failed multiple tests, and someone pointed out that these issues can stem from load(). I've looked over my load code and I've looked at other questions on SE but I can't find anything ...
SuperNovaCoder's user avatar
0 votes
1 answer
157 views

CS50 pset5 unload trie segmentation fault

I am having problems with implementing unload. load works perfectly and I can use the check function. I have tried many ways of changing my code but it only creates an infinite loop and I have no idea ...
Jiwoon Kim's user avatar
2 votes
1 answer
87 views

PSET5 Speller / Dictionary - Seg Fault and Incorrect Check

"debug50 ./speller texts/alice.txt" doesn't return a segfault. It runs to completion. But "./speller texts/alice.txt" returns a segfault. Can I PM someone my code to take a look at? Why would running ...
Spenny Davis's user avatar
0 votes
1 answer
107 views

Segmentation fault..Please Help

can anyone have a look at my code, find the problem and suggest improvements. im getting segmentation fault after calling 'check' function. typedef struct trie { bool word; struct trie* link[27];...
Suhas S's user avatar
0 votes
0 answers
30 views

I am blind. Can't find my error :(

I am trying to setup a server that can save some messages sent from a client. I took apart some code given in an example i found here. This is where I am now. Ive tried to change some stuff here ...
Jake's user avatar
  • 96
0 votes
1 answer
68 views

Pset6 Server seg fault in load and main (because of parse)

Server is functional and gives the correct output using the curl requests individually. However, using gdb, if I use curl to request hello.html after I've requested cat.html (specifically), I get a ...
Joshua van Niekerk's user avatar
0 votes
1 answer
203 views

Pset4, Recover, GDB on fread gives an "Coud not open file" error and segfault

I have been getting segmentation fault on my code, when i try to debug it, it gives me this error: Error opening file Could not open file: /build/buildd/eglibc-2.19/libio/iofread.c The file could not ...
qua11q7's user avatar
  • 11
0 votes
1 answer
359 views

pset5 Segmentation fault

I've been getting a seg fault in load on this line: buckets[hash_num] = buffer_node;. I have read most if not all the posts on seg faults in load, and can't seem to figure mine out. At first I ...
April's user avatar
  • 1
0 votes
1 answer
92 views

Help with seg fault in pset5 speller

My speller seg faults at the space following the first word in whatever input text I use. Here is the gdb output for austinpowers.txt with the segfault just after reading the word AUSTIN: 107 ...
Robert Feduniak's user avatar
0 votes
1 answer
112 views

My code will only print 23 jpg's which are unreadable, I have been stuck a long time already, xxd'd the jpg's and everything seems to be fine

/** * recover.c * * Computer Science 50 * Problem Set 4 * * Recovers JPEGs from a forensic image. */ #include <stdio.h> #include <stdint.h> #include <cs50.h> typedef uint8_t ...
Lesscomfortable's user avatar
0 votes
1 answer
230 views

pset5 segfault in unload

FINAL EDIT My function that frees the memory works properly; the problem lies in node creation. I now have a separate problem where the program segfaults when run normally, but it cannot be ...
jiewpeng's user avatar
  • 115
0 votes
2 answers
164 views

Segfault in pset5 in load

My implementation of load uses a trie and when I attempt to access the bool is_word I get a segfault. Can you guys help me out? Any suggestions on how to improve my code would be amazing. Thanks ...
Caed Budris's user avatar
0 votes
1 answer
80 views

pset6 server giving segfault

When I add the below two blocks I get a segfault when I submit a request from telnet. Actually, I can add just the first and things run fine but upon the second (or even moving the first up above ...
Norcim133's user avatar
1 vote
1 answer
231 views

pset5 load function segfault do not show in gdb

I cannot figure what's wrong with the code, it gives me a segfault, but runs in valgrind and in gdb. So far, i only wrote the load function, so anything else is still empty. #include <stdbool....
user10187's user avatar
0 votes
2 answers
1k views

Pset5 Speller - segmentation fault is driving me crazy!

Hey guys! I have been working on pset5 for a while and I keep on obtaining a seg fault. I have alreay run valgrind but it gives me no error. I cannot really see where is the problem. Any help will be ...
Stefano Perrotta's user avatar
1 vote
1 answer
638 views

pset5 speller.c with hashtable errors and seg fault

this is my code so far for pset5. I would appreciate giving me hints about my erros. I also get a segmentation fault. thanks. when I implemented load and check only, it seemed to load the text and ...
Riham Nour's user avatar
0 votes
1 answer
118 views

pset4 recover.c sge fault cant find first jpg signature

Here is my code. I keep getting a segmentation fault while iterating over beginning of bufferArray[512] looking for the first jpg signature. Please help! I cant see what i've done wrong. Im trying to ...
noneofyourbusiness's user avatar
0 votes
2 answers
96 views

Vigenere code has Segmentation error

I've been working on the vigenere.c problem from pset2 and am struggling to find the error in my code currently because whenever I try to run it my code crashes. Clearly there is something wrong but I ...
Joan_Dewey's user avatar
0 votes
1 answer
487 views

pset4 recover segfault: no such file/directory

My code seems to have trouble making the .jpg files in which to place the blocks of data. #include <stdio.h> #include <stdlib.h> #include <stdint.h> uint8_t buffer[512]; uint8_t ...
Joey Beaudette's user avatar
0 votes
1 answer
6k views

How to iterate through an array using pointers

I managed to "solve this issue", but I don't know why I get the problem I get. Right after the last line I also got a segmentation fault, which I failed to include in the above screenshot. My ...
Jon's user avatar
  • 21
0 votes
1 answer
87 views

segfaults and delayed printf commands while using GWindow in loop

printf("%c.\n", (getText(precrmo_menu[3]))[0]); char input[3]; input[0] = (getText(precrmo_menu[3]))[0]; printf("we lived"); if (strcmp(input, "") != 0 && !isblank(input) && ...
Michael F's user avatar
  • 293
0 votes
1 answer
83 views

Why does server.c's error function not malloc "phrase"?

The error function defines phrase as follows: const char* phrase = NULL; switch (code) { case 400: phrase = "Bad Request"; break; case 403: phrase = "Forbidden"; break; case 404: phrase = ...
Michael F's user avatar
  • 293
5 votes
1 answer
695 views

Is something wrong with getType(object)?

For pset4, in this code(in main, to check collision of ball and anything else): GObject object = detectCollision(window, ball); if (strcmp(getType(object), "GRect") == 0) { ...
Confused Guy's user avatar
0 votes
1 answer
3k views

Speller Unload Trie with Recursion

node* root; bool unload(void) { freenodes(root); return true; } freenodes function(node* path) { loop over all nodes { if node is not null (path -> children[i]) ...
Adam Wilson's user avatar
0 votes
1 answer
230 views

Segfault Pset6 Check()

I receive a segfault at this line of code if (pathCheck -> children[charVal] == NULL) { return false; } pseudocode buildup: initialise pathCheck to NULL while character is ...
Adam Wilson's user avatar
0 votes
1 answer
3k views

Why do I get a segmentation fault when writing to a string?

The following code receives seg fault on line 2: char *str = "string"; str[0] = 'z'; printf("%s", str); While this works perfectly well: char str[] = "string"; str[0] = 'z'; printf("%s", str); ...
Phillip's user avatar
  • 15