segmentation-fault

Referencing pointers after a fork() call in C

耗尽温柔 提交于 2019-12-24 03:36:08
问题 So, I've got a function that loads up a char** variable with some string data. My goal is to fork the process, and print some of that data in the child, and some from the parent. However, I'm unable to reference the pointer after the fork() call. I thought that fork() made a copy of the entire address space of the parent process, which seems that it would include the various stack pointers... Essentially, my code currently looks like this: load_data(char **data); char** data; load_data(data);

Segmentation fault with array of strings C

时间秒杀一切 提交于 2019-12-24 03:12:40
问题 I have made a program that breaks a string into tokens separated by space and then copies each separate string into an array of strings. Program works fine until it reaches for-loop and after successfully adding the first string into the array and printing it, program crashes. I debugged it and found that args[i] = malloc((strlen(comm_str) + 1) * sizeof(char)); returns SEGFAULT then performing loop for the second time. Also call stack prints out the following: Address: 75F943F9, Function:

Segmentation Fault After Main Returns

*爱你&永不变心* 提交于 2019-12-24 02:31:24
问题 I receive a segmentation fault after the main function returns. I have commented out everything below the last item that displays on the screen. That was of no use. Therefore I'm not sure what to do because it doesn't seem that the stack is corrupted and I am definitely not going out of bounds on any of my arrays because I'm pretty sure that I checked that. Any help would be great. Thanks, Joe My code is: (sorry about the formatting, this website messed it all up even though i used the 4

Why didn't I get segmentation fault when storing past the end of the BSS?

爷,独闯天下 提交于 2019-12-24 01:54:30
问题 I'm experimenting with assembly language and wrote a program which prints 2 hardcoded bytes into stdout. Here it is: section .text global _start _start: mov eax, 0x0A31 mov [val], eax mov eax, 4 mov ebx, 1 mov ecx, val mov edx, 2 int 0x80 mov eax, 1 int 0x80 segment .bss val resb 1; <------ Here Note that I reserved only 1 byte inside the bss segment, but actually put 2 bytes (charcode for 1 and newline symbol) into the memory location. And the program worked fine. It printed 1 character and

Why does x86 program segfault without .data section? [duplicate]

一曲冷凌霜 提交于 2019-12-24 01:46:18
问题 This question already has an answer here : ASM x64 scanf printf double, GAS (1 answer) Closed 3 years ago . I'm making a basic assembly subtraction function and printing the result to the console. Here's the code I think SHOULD work: (compiled with as output.s , ld a.out -e _start -o output ) .bss output: .int .text .global _start _start: movl $9, %eax movl %eax, %ebx movl $8, %eax subl %eax, %ebx movl %ebx, (output) # ASCII for digits is 0x30 greater than digit value addl $0x30, output movl

How do I debug a segmentation fault in Mono on Ubuntu without any debugger?

江枫思渺然 提交于 2019-12-24 01:18:32
问题 I have an application that I recently split to run in separate processes that communicate with each other via local sockets. I split it out in hopes of increasing stability, as the core "watcher" process can detect a failure and restart the afflicted sub-process. However, now my watcher process frequently crashes with only the message "Segmentation Fault". I've surrounded all threaded operations in try/catch blocks to try to dump any output, but I still get the same results. I have been

Why does this PHP function give a segmentation fault (SIGSEGV)?

↘锁芯ラ 提交于 2019-12-24 01:12:49
问题 I wrote the following code. <?php function f(){ return f(); } f(); and get the output $ php test.php Segmentation fault Why? I didn't use any pointers. This is StackOverflow ? 回答1: This is a case of infinite recursion, but that is not specifically the cause. It is a stack overflow. When you have recursion, whether infinite or not, there is a max amount of depth you can recurse (add to the stack) which is based on the size of your stack (in bytes). Technically this is infinite, but you won't

Segmentation Faults when Running MEX Files in Parallel

烂漫一生 提交于 2019-12-24 00:54:57
问题 I am currently running repetitions of an experiment that uses MEX files in MATLAB 2012a and occasionally running into segmentation faults that I cannot understand. Some information about the faults They occur randomly They only occur when I run multiple repetitions of my experiment in parallel on a Linux machine using a parfor loop. They do not occur when I run multiple repetitions of my experiment in parallel on Mac OSX 10.7 using a parfor loop. They do not occur when I run or do they occur

Prevent Flash Player fault in WebView, as is done by the Android Browser

假装没事ソ 提交于 2019-12-24 00:45:09
问题 I'm loading .swf files into a WebView directly using webView.loadUrl("http://whatever.com/file.swf"); . It works perfectly in the vast majority of cases. When loading a few specific swf files on certain devices, though, shortly after the Flash media begins to be displayed, my app closes with a Signal 11 fault caused by the Flash Player plugin. Example LogCat dump here . No Exception is thrown. The same thing happens if I load those files into the xScope browser . When loading them into

Segmentation fault on exit in pyQt5 but not pyQt4

心已入冬 提交于 2019-12-24 00:22:59
问题 The workaround to a crash upon exit given in this answer works in pyqt4. But not using pyqt5, where there is often (more than half the times) a segmentation fault. Only the import lines changed #!/usr/bin/python import sys #toolkit = "Qt4" toolkit = "Qt5" if toolkit == "Qt4": # Qt4 (no crash) from PyQt4.QtCore import * from PyQt4.QtGui import * elif toolkit == "Qt5": # Qt5 (crash) from PyQt5.QtWidgets import ( QApplication, QGraphicsScene, QGraphicsView ) app = QApplication(sys.argv) grview =