Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
2
votes
How to copy a string in pset2? strcpy results in segfault
The main reason for the seg fault is this string titleized_string = "";. As soon as you "set" titleized_string to "something-in-quotes" it becomes a constant. You cannot strcpy into a constant (it ha …
1
vote
Accepted
PSet2 Vigenere Segmentation Fault Error
To clarify: the error /opt/sandbox50/bin/run.sh: line 31: 11290 .... is from check50, not from compile. It happens when check50 tests for "handles lack of argv[1]". That is because you do string k = a …
1
vote
Accepted
server.c segmentation fault
Your first order of business is finding out where it seg faults. valgrind is telling you it does, now you need gdb to tell you where.
To get started with gdb:
$ gdb ./server
(gdb) break parse
(gdb) …
1
vote
Pset6 - CS50. Segmentation fault for free(index)
Looks like a small memory leak in loookup. Maybe you're declaring a variable to store extension, but it's not allocated to include a null-terminator?
The indexes function looks fine. I think index is …
1
vote
Accepted
Problem when testing pset6 parse method - Segmentation Fault
This declaration char* request = ""; basically makes request a const char*, and as such is immutable. You should not "set" it to "", rather it needs to have some memory allocated before anything is co …
1
vote
Accepted
This code is written as per video in CS50 week 4 but it is not working
You are always using the subscript 'i'. 'i' has the value 3 when the first loop is finished. You can either change the subscript names in the y loop and the x loop OR just use 'i' again to run those l …
1
vote
Accepted
PSET6 Parse Segmentation Fault
When you declare a string literal, as with char* php = "";,it is stored in read-only memory. So it is indeed seg-faulting here strcpy(php, path); because it cannot change read-only memory.
Even if th …
1
vote
Accepted
Pset6 Indexes Server.c - Segmentation Fault
There are problems in this index function. However, they are not causing all the check50 failures. Those problems probably stem from load function. Since check50 (probably) makes a direct request to c …
1
vote
Accepted
pset5 load function seg fault with 1 error from Valgrind
This hashtable[hash]->next = new_node; is a problem. hashtable is defined as an array of node pointers, not nodes. Therefore there is no such thing as hahstable[hash]->next. Maybe you meant hashtable[ …
1
vote
Accepted
pset4(recover-less): Segmentation Fault
Program never finds a jpg sig, so when it tries to fclose(img); it seg faults because img is NULL.
Verify your "sig test". This (buffer[3]&0xf0)==0xe00) is wrong. (0xe00 is two bytes).
But wait t …
1
vote
Accepted
Pset5 Speller constantly giving seg fault
What happens here else if (trav -> children[letter - 'a'] == NULL) if letter is apostrophe (ascii 39)?
1
vote
Pset3 counting sort - segmentation fault error
This would work if no element of the values array is greater than 5. Since counts is initialized to limit, it has 5 elements, indexes 0 through 4. What happens here counts[values[i]-1]++; if values[i] …
1
vote
Accepted
pset5 speller works in debug mode, throws segfault otherwise
The reason it does not give a seg fault under gdb is because of different memory usage than when it's run from the command line. The problem lies in the hash function. You might have started out with …
1
vote
Accepted
CS50 Vigenere Segmentation Fault
It looks like it will fail here else if (isalpha(argv) == 0) (I did not read the code further).
argv is an array of strings. Review the man page for isalpha to be reminded that it takes a single cha …
1
vote
Accepted
PSET3 -I am getting segmentation fault
This else block will execute exactly once (providing a jpeg sig is found in the input file):
else//file not opened yet -
{
count++;
char filena …