[BUG] `Too many function arguments, the program crashes`
When there are too many function arguments, the program crashes with no output error after encryption with pyarmor. I have a PyQt6 program, I put the menu production in a function, part of the content is shown below, after testing, when the function parameters passed too much, using pyarmor after confusing the code can not be used normally, I use the command is:
pyarmor cfg data_files=*
pyarmor gen --recursive --enable-bcc --obf-code 2 --output xapp_dist_pyarmor xapp_workspace
In the following example, if my argument is passed into the callback13 position, the muddled code still runs, but when one more argument is passed, it starts to crash without any error output
def rtl_source(
menu,
item_type,
top_module,
check_status,
callback1,
callback2,
callback3,
callback4,
callback5,
callback6,
callback7,
callback8,
callback9,
callback10,
callback11,
callback12,
callback13,
# callback14,
# callback15,
# callback16,
# callback17,
# callback18,
# callback19,
# callback20,
):
pass
When the --enable-bcc option is not used, the pyarmor obfuscated program works fine
Reproduced, I'll check it and fix it when I'm back office next Monday.
What's your platform? This issue is reproduced in darwin.arm64, but not in darwin.x86_64.
Platform windows.x86_64
I made a mistake, the crash in darwin.arm64 is codesign issue, not bcc issue.
And I can't reproduce this issue in Windows 7 (x86_64) by Python 3.7 and 3.8
The test script is t1841.py
def rtl_source(
menu,
item_type,
top_module,
check_status,
callback1,
callback2,
callback3,
callback4,
callback5,
callback6,
callback7,
callback8,
callback9,
callback10,
callback11,
callback12,
callback13,
callback14,
callback15,
callback16,
callback17,
callback18,
callback19,
callback20,
):
print(
menu,
item_type,
top_module,
check_status,
callback1,
callback2,
callback3,
callback4,
callback5,
callback6,
callback7,
callback8,
callback9,
callback10,
callback11,
callback12,
callback13,
callback14,
callback15,
callback16,
callback17,
callback18,
callback19,
callback20,
)
if __name__ == '__main__':
args = list(range(24))
rtl_source(*args)
The test steps:
pyarmor gen --enable-bcc t1841.py
python3 dist/t1841.py
It works fine in test env.
windows Platform: windows11 Windows.x86_64 Pyarmor version: Pyarmor 8.5.9 Python version: 3.12.4 All callbacks in the above example use lambda functions
Does it work or not with my test script and test steps in your environments?
Actually I guess it's not too many arguments issue, but something else.
At least in my example, it is caused by too many arguments, and when a certain number is reached, there will be a crash.
Is the code snippet shown above in PyQt6.