Buffer or stack overflow crashing GUI

-2

I am getting a GUI widget from PyQt5 to work with another python class that reads from 2 text files then compare the values. The program runs all the way through the code but then crashes the GUI after running the comparison. I need a way to prevent this from happening.

It gives exit code:

-1073740791 (0xC0000409). Which is a "Stack buffer overflow / overrun. Error can indicate a bug in the executed software that causes stack overflow, leading to abnormal termination of the software."

I have replaced a nested for loop with a loop that utilizes zip(). This still crashed it.

for testdata,idledata in zip(TestAverage, IdleAverage):#comparing
        if (testdata.DLC == 2):
           byte1 = testdata.byteRatio[0] - idledata.byteRatio[0]
           byte2 = testdata.byteRatio[1] - idledata.byteRatio[1]
           byte11 = testdata.rateOfChange[0] - idledata.rateOfChange[0]
           byte12 = testdata.rateOfChange[1] - idledata.rateOfChange[1]
        if (testdata.DLC == 4):
            byte1 = testdata.byteRatio[0] - idledata.byteRatio[0]
            byte2 = testdata.byteRatio[1] - idledata.byteRatio[1]
            byte3 = testdata.byteRatio[2] - idledata.byteRatio[2]
            byte4 = testdata.byteRatio[3] - idledata.byteRatio[3]
            byte11 = testdata.rateOfChange[0] - idledata.rateOfChange[0]
            byte12 = testdata.rateOfChange[1] - idledata.rateOfChange[1]
            byte13 = testdata.rateOfChange[2] - idledata.rateOfChange[2]
            byte14 = testdata.rateOfChange[3] - idledata.rateOfChange[3]
        if(testdata.DLC == 5):
            byte1 = testdata.byteRatio[0] - idledata.byteRatio[0]
            byte2 = testdata.byteRatio[1] - idledata.byteRatio[1]
            byte3 = testdata.byteRatio[2] - idledata.byteRatio[2]
            byte4 = testdata.byteRatio[3] - idledata.byteRatio[3]
            byte5 = testdata.byteRatio[4] - idledata.byteRatio[4]
            byte11 = testdata.rateOfChange[0] - testdata.rateOfChange[0]
            byte12 = testdata.rateOfChange[1] - idledata.rateOfChange[1]
            byte13 = testdata.rateOfChange[2] - idledata.rateOfChange[2]
            byte14 = testdata.rateOfChange[3] - idledata.rateOfChange[3]
            byte15 = testdata.rateOfChange[4] - idledata.rateOfChange[4]
        if (testdata.DLC == 6):
            byte1 = testdata.byteRatio[0] - idledata.byteRatio[0]
            byte2 = testdata.byteRatio[1] - idledata.byteRatio[1]
            byte3 = testdata.byteRatio[2] - idledata.byteRatio[2]
            byte4 = testdata.byteRatio[3] - idledata.byteRatio[3]
            byte5 = testdata.byteRatio[4] - idledata.byteRatio[4]
            byte6 = testdata.byteRatio[5] - idledata.byteRatio[5]
            byte11 = testdata.rateOfChange[0] - idledata.rateOfChange[0]
            byte12 = testdata.rateOfChange[1] - idledata.rateOfChange[1]
            byte13 = testdata.rateOfChange[2] - idledata.rateOfChange[2]
            byte14 = testdata.rateOfChange[3] - idledata.rateOfChange[3]
            byte15 = testdata.rateOfChange[4] - idledata.rateOfChange[4]
            byte16 = testdata.rateOfChange[5] - idledata.rateOfChange[5]
        if (testdata.DLC == 7):
            byte1 = testdata.byteRatio[0] - idledata.byteRatio[0]
            byte2 = testdata.byteRatio[1] - idledata.byteRatio[1]
            byte3 = testdata.byteRatio[2] - idledata.byteRatio[2]
            byte4 = testdata.byteRatio[3] - idledata.byteRatio[3]
            byte5 = testdata.byteRatio[4] - idledata.byteRatio[4]
            byte6 = testdata.byteRatio[5] - idledata.byteRatio[5]
            byte7 = testdata.byteRatio[6] - idledata.byteRatio[6]
            byte11 = testdata.rateOfChange[0] - idledata.rateOfChange[0]
            byte12 = testdata.rateOfChange[1] - idledata.rateOfChange[1]
            byte13 = testdata.rateOfChange[2] - idledata.rateOfChange[2]
            byte14 = testdata.rateOfChange[3] - idledata.rateOfChange[3]
            byte15 = testdata.rateOfChange[4] - idledata.rateOfChange[4]
            byte16 = testdata.rateOfChange[5] - idledata.rateOfChange[5]
            byte17 = testdata.rateOfChange[6] - idledata.rateOfChange[6]
        if (testdata.DLC == 8):
            byte1 = testdata.byteRatio[0] - idledata.byteRatio[0]
            byte2 = testdata.byteRatio[1] - idledata.byteRatio[1]
            byte3 = testdata.byteRatio[2] - idledata.byteRatio[2]
            byte4 = testdata.byteRatio[3] - idledata.byteRatio[3]
            byte5 = testdata.byteRatio[4] - idledata.byteRatio[4]
            byte6 = testdata.byteRatio[5] - idledata.byteRatio[5]
            byte7 = testdata.byteRatio[6] - idledata.byteRatio[6]
            byte8 = testdata.byteRatio[7] - idledata.byteRatio[7]
            byte11 = testdata.rateOfChange[0] - idledata.rateOfChange[0]
            byte12 = testdata.rateOfChange[1] - idledata.rateOfChange[1]
            byte13 = testdata.rateOfChange[2] - idledata.rateOfChange[2]
            byte14 = testdata.rateOfChange[3] - idledata.rateOfChange[3]
            byte15 = testdata.rateOfChange[4] - idledata.rateOfChange[4]
            byte16 = testdata.rateOfChange[5] - idledata.rateOfChange[5]
            byte17 = testdata.rateOfChange[6] - idledata.rateOfChange[6]
            byte18 = testdata.rateOfChange[7] - idledata.rateOfChange[7]

I expect to rewrite part of the program to prevent this exit from the GUI.

python
pyqt5
stack-overflow
buffer-overflow
buffer-overrun
asked on Stack Overflow Apr 12, 2019 by Samp • edited Apr 12, 2019 by Joey Mallone

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0