WIP: Fix Flake8 warnings (#2101)

* Fix F811

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@outlook.com>

* A003 doesn't flag anymore, rule was changed

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@outlook.com>

* W505

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@outlook.com>

* Revert "W505"

This reverts commit 2494a34c20.

* Revert "A003 doesn't flag anymore, rule was changed"

This reverts commit d342ac7aae.

* Removed a commented line

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@outlook.com>

* Mistakenly modified another variable

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@outlook.com>

* Replace not None assertion to not empty string

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@outlook.com>

---------

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@outlook.com>
This commit is contained in:
jetchirag 2024-04-12 18:25:50 +05:30 committed by GitHub
parent 6139d0b030
commit ebcff7cd59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 2 additions and 23 deletions

View File

@ -1,7 +1,6 @@
from __future__ import annotations
import cProfile
import glob
import locale
import os
import site

View File

@ -415,7 +415,6 @@ def map_inner(ei_class, ehdr, objfile: str) -> Tuple[pwndbg.lib.memory.Page, ...
vaddr = int(phdr.p_vaddr)
offset = int(phdr.p_offset)
flags = int(phdr.p_flags)
# ptype = int(phdr.p_type)
memsz += pwndbg.lib.memory.page_offset(vaddr)
memsz = pwndbg.lib.memory.page_size_align(memsz)

View File

@ -11,7 +11,6 @@ ignore = [
"E501",
"E731",
"F405",
"F811",
"F821",
"W505",
]

View File

@ -201,14 +201,6 @@ def test_try_free_corrupted_consolidate_backward(start_binary):
os.remove(OUTPUT_FILE)
def test_try_free_corrupted_consolidate_backward(start_binary):
chunks = setup_heap(start_binary, 13)
result = gdb.execute(f"try_free {hex(chunks['e'])}", to_string=True)
assert "corrupted size vs. prev_size while consolidating" in result
os.remove(OUTPUT_FILE)
@pytest.mark.skip(
reason="Needs review. In the heap.py on the line 972 the condition is true always. The heap_bug.c file has the function: corrupted_unsorted_chunks()"
)

View File

@ -11,13 +11,13 @@ def test_command_kbase():
def test_command_kchecksec():
res = gdb.execute("kchecksec", to_string=True)
assert res is not None # for F841 warning
assert res != "" # for F841 warning
# TODO: do something with res
def test_command_kcmdline():
res = gdb.execute("kcmdline", to_string=True)
assert res is not None # for F841 warning
assert res != "" # for F841 warning
# TODO: do something with res

View File

@ -61,16 +61,6 @@ def test_nozero_flags():
assert 0x0 == next(find_fastbin_size(buf, max_size, 8))
def test_normal():
max_size = 0x20
offsets = {
0x8: 0x20,
}
buf = setup_mem(max_size, offsets)
assert 0x0 == next(find_fastbin_size(buf, max_size, 1))
assert 0x0 == next(find_fastbin_size(buf, max_size, 8))
def test_unaligned():
max_size = 0x20
offsets = {