leopardslab / leopardslab/expressPython

[BUG] ASAN Heap-after-use error

Open
#18 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Stack trace:

READ of size 11 at 0x60600044ebf8 thread T0
    #0 0x7f0c509e1a6c  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x67a6c)
    #1 0x7f0c50655cd8 in PyUnicode_FromString (/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0+0x229cd8)
    #2 0x558bce5341bc in Jedi::AutoComplete(QString const&, long, long) (/home/harshit/expressPython-1/expressPython+0x9c1bc)
    #3 0x558bce50ac1d in CodeEditor::keyPressEvent(QKeyEvent*) (/home/harshit/expressPython-1/expressPython+0x72c1d)
    #4 0x7f0c4fec577c in QWidget::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1ad77c)
    #5 0x7f0c4ff72d51 in QFrame::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x25ad51)
    #6 0x7f0c4ff759d0 in QAbstractScrollArea::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x25d9d0)
    #7 0x7f0c5004bab8 in QPlainTextEdit::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x333ab8)
    #8 0x7f0c4fe82a65 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x16aa65)
    #9 0x7f0c4fe8c81d in QApplication::notify(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x17481d)
    #10 0x7f0c4f46a939 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x286939)
    #11 0x7f0c4fee4215  (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1cc215)
    #12 0x7f0c4fe82a65 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x16aa65)
    #13 0x7f0c4fe8c0ef in QApplication::notify(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1740ef)
    #14 0x7f0c4f46a939 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x286939)
    #15 0x7f0c4f84fb2a in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x122b2a)
    #16 0x7f0c4f8550f0 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x1280f0)
    #17 0x7f0c4f82f35a in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x10235a)
    #18 0x7f0c48a7432d  (/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5+0x7932d)
    #19 0x7f0c4e3b4fbc in g_main_context_dispatch (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51fbc)
    #20 0x7f0c4e3b523f  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5223f)
    #21 0x7f0c4e3b52e2 in g_main_context_iteration (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x522e2)
    #22 0x7f0c4f4c2564 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2de564)
    #23 0x7f0c4f4694da in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2854da)
    #24 0x7f0c4f471245 in QCoreApplication::exec() (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x28d245)
    #25 0x558bce4bb5f6 in main (/home/harshit/expressPython-1/expressPython+0x235f6)
    #26 0x7f0c4ee1b0b2 in __libc_start_main (/usr/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #27 0x558bce4bbd4d in _start (/home/harshit/expressPython-1/expressPython+0x23d4d)

0x60600044ebf8 is located 24 bytes inside of 64-byte region [0x60600044ebe0,0x60600044ec20)
freed by thread T0 here:
    #0 0x7f0c50a877cf in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf)
    #1 0x558bce53478c in Jedi::AutoComplete(QString const&, long, long) (/home/harshit/expressPython-1/expressPython+0x9c78c)
    #2 0x558bce50ac1d in CodeEditor::keyPressEvent(QKeyEvent*) (/home/harshit/expressPython-1/expressPython+0x72c1d)
    #3 0x7f0c4fec577c in QWidget::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1ad77c)

previously allocated by thread T0 here:
    #0 0x7f0c50a87ffe in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe)
    #1 0x7f0c4f2ae2df in QArrayData::reallocateUnaligned(QArrayData*, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xca2df)

SUMMARY: AddressSanitizer: heap-use-after-free (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x67a6c) 
Shadow bytes around the buggy address:
  0x0c0c80081d20: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c0c80081d30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c80081d40: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
  0x0c0c80081d50: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c0c80081d60: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
=>0x0c0c80081d70: fa fa fa fa fa fa fa fa fa fa fa fa fd fd fd[fd]
  0x0c0c80081d80: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fa
  0x0c0c80081d90: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
  0x0c0c80081da0: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x0c0c80081db0: fd fd fd fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c0c80081dc0: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==667729==ABORTING```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Jedi::AutoComplete and CodeEditor::keyPressEvent, the application frames identified by the AddressSanitizer trace. Reproduce the heap-use-after-free under ASAN and trace the allocation, free, and subsequent read. Done means the reported use-after-free no longer occurs during the affected editor interaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
desktop, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.