segmentation-fault

Using a function to remove duplicates from an array in C++

偶尔善良 提交于 2019-12-05 14:21:08
I'm writing a program that has a user input integers into an array, calls a function that removes duplicates from that array, and then prints out the modified array. When I run it, it lets me input values into the array, but then gives me a "Segmentation fault" error message when I'm done inputing values. What am I doing wrong? Here is my code: #include <iostream> using namespace std; void rmDup(int array[], int& size) { for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { if (array[i] == array[j]) { array[i - 1 ] = array[i]; size--; } } } } int main() { const int CAPACITY =

Segmentation Fault Catch

泄露秘密 提交于 2019-12-05 13:53:27
I have a python script and it will loop through bunch of maya files and do some stuff. But some time maya get seg fault and my script will stop there. I tried with signal and multiprocess. But both failed import os, optparse, glob, json, signal import maya.standalone import maya.cmds as cmds from multiprocessing import Process, Queue def loadMayaBd(): maya.standalone.initialize(name='python') def sig_handler(signum, frame): print "segfault" def doSome(args, options): signal.signal(signal.SIGSEGV, sig_handler) loadMayaBd() #from here its just a example fileNameList = args[0] for eachFile in

objdump with nodejs script that throws segmentation error

情到浓时终转凉″ 提交于 2019-12-05 13:38:55
I have nodejs script that throws Error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) After I included var SegfaultHandler = require('segfault-handler'); SegfaultHandler.registerHandler("crash.log"); // With no argument, SegfaultHandler will generate a generic log file name I got this stack trace: PID 2645 received SIGSEGV for address: 0x0 0 segfault-handler.node 0x00000001034ae1c8 _ZL16segfault_handleriP9__siginfoPv + 280 1 libsystem_platform.dylib 0x00007fff9364b52a _sigtramp + 26 2 ??? 0x0000000000000010 0x0 + 16 3 node 0x000000010067bbdc _ZN2v88internal23Runtime

PHP doesn't handle stack overflow?

天涯浪子 提交于 2019-12-05 13:36:45
I was surprised when I just tried the following PHP code: function foo() { foo(); } foo(); I expected to get "500: Internal server error". Instead the connection was closed immediately (no bytes received), and the log files show that apache segfaulted. WTF? Is this a known bug in PHP? Are there some configuration options that I'm missing? Because a crashed process for every accidental stack overflow is, well... pretty unacceptable, I think. Lizard PHP is not able to deal with this, it will just go into an infinite loop and produce a segmentation fault. http://bugs.php.net/bug.php?id=49823 also

STL List to hold structure pointers

那年仲夏 提交于 2019-12-05 13:18:28
I have a structure called vertex and I created some pointers to them. What I want to do is add those pointers to a list. My code below, when it tries to insert the pointer into the list, creates a segmentation fault. Can someone please explain what is going on? #include <iostream> #include <list> #define NUM_VERTICES 8 using namespace std; enum { WHITE, GRAY, BLACK }; struct vertex { int color; int distance; char parent; }; int main() { //create the vertices vertex r = {WHITE, NULL, NULL}; //create pointer to the vertex structures vertex *pr = &r; //create a list to hold the vertices list

Segmentation fault on gcc caused by lambda wrapper over variadic template function call

醉酒当歌 提交于 2019-12-05 13:00:47
问题 I've spent quite a few hours today trying to understand why this code segfaults on g++6.2 and g++7.0 , while happily working as intended on clang++3.9 (and 4.0 ) . I reduced the issue to a 85 lines self-contained code snippet, which does not segfault upon normal execution, but always reports an error under UBSAN. The issue is reproducible on wandbox, by compiling with g++7 , enabling optimizations and passing -fsanitize=undefined as an extra flag. This is what UBSAN reports: prog.cc: In

EXC_BAD_ACCESS (SIGSEGV) in WebCore::UserGestureIndicator::processingUserGesture

佐手、 提交于 2019-12-05 12:46:59
问题 I have an iOS application built using a UIWebView and HTML5 websockets. The app experiences seemingly random crashes. It has occurred while a user is interacting with it and during longevity tests where no interaction between user and app occurs. The crash logs all have the following: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000 and the thread logs contain: Thread XX name: WebCore: Worker Thread XX Crashed: 0 WebCore 0x36c8c7a0 WebCore:

Application gives segmentation fault randomly in python extension functions in c++

只愿长相守 提交于 2019-12-05 12:26:51
I am experiencing some stange problem in python extension in c++. I appreciate any help or suggestions. To set context. I am using embedded python in C++ to execute python scripts. I am also using python extension in c++ to give ability to python script to call the C++ function. What is problem? When I comment method entry from modules “method table” like I have shown below. Application never crashes or I am not experiencing segfault at all. static PyMethodDef sa_methods[] = { //{"GetBlue",(PyCFunction)sa_GetBlue,METH_VARARGS,PyDoc_STR("fetches Blue color")}, //{"GetRed",(PyCFunction)sa_GetRed

Android installing apk to device gives [SEGMENTATION FAULT]

混江龙づ霸主 提交于 2019-12-05 11:55:00
i have a problem. When i am trying to deploy (Debug or Run) my App with the AndroidStudio, i get the following error in the RunLog Waiting for device. Target device: samsung-galaxy_nexus-WOVCBUF6BAGENRTO Uploading file local path: C:\Users\Abracadabra\Desktop\......\app\build\outputs\apk\app-debug.apk remote path: /data/local/tmp/xxx.xxx.app Installing xxx.xxx.app DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/xxx.xxx.app" Segmentation fault It works fine when i try to deploy it to the genymotion VM. It just does not work on my real device. It did work before, but i have cleaned up some

Catching segfault with debugger in Python

坚强是说给别人听的谎言 提交于 2019-12-05 11:35:24
I want to debug a Python program which is often stuck. Basically, my program runs a spyne-server which accepts SOAP requests. My program is multi-threaded and sometimes, the client I use to reach it timeouts. I've tryed severals debuggers such as PUDB, PDB, WINPDB, PYSTUCK but I wasn't able to catch any exception from them, in fact they happen to be stuck too (CTRL+C doesnt work...) The best I've achieved was from GDB with the following command: gdb -ex r --args python myscript.py GDB manages to catch the exception but doesn't display any usefull informations: Program received signal SIGSEGV,