This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: binascii.Error: Incorrect padding
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Tester, bradengroom, serhiy.storchaka, terry.reedy, xtreak
Priority: normal Keywords:

Created on 2018-10-27 23:49 by Tester, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
_usr_lib_python3.6_base64.py.1000.zip Tester, 2018-11-01 13:03
Messages (15)
msg328664 - (view) Author: TestUser (Tester) Date: 2018-10-27 23:49
The below "test.code1" is not base64 encoded. Though, it is a good file.

t:~$ python3 -m base64 -d test.code1
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.6/base64.py", line 602, in <module>
    main()
  File "/usr/lib/python3.6/base64.py", line 586, in main
    func(f, sys.stdout.buffer)
  File "/usr/lib/python3.6/base64.py", line 512, in decode
    s = binascii.a2b_base64(line)
binascii.Error: Incorrect padding
msg328674 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-10-28 05:35
Thanks for the report. Can you please attach the file test.code1? Your original report says "test.code1" is not base64 encoded and -d takes a file that is base64 encoded and decodes it. Can you please be more descriptive about what you are expecting?
msg328732 - (view) Author: TestUser (Tester) Date: 2018-10-28 19:49
The file contained the following code:
0x11a3ff119c\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80#%^ciuqrfiqrYWJjMTIzIT8kKiYoKSctPUB-
abc123!

On Sun, Oct 28, 2018 at 1:35 AM Karthikeyan Singaravelan <
report@bugs.python.org> wrote:

>
> Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment:
>
> Thanks for the report. Can you please attach the file test.code1? Your
> original report says "test.code1" is not base64 encoded and -d takes a file
> that is base64 encoded and decodes it. Can you please be more descriptive
> about what you are expecting?
>
> ----------
> nosy: +xtreak
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35084>
> _______________________________________
>
msg328735 - (view) Author: TestUser (Tester) Date: 2018-10-28 20:08
FYI: This error generates an Ubuntu Crash Report. Every time I use it on
the CLI. I wonder how many of these are generated?

On Sun, Oct 28, 2018 at 3:49 PM TestUser <report@bugs.python.org> wrote:

>
> TestUser <nullbackslashnull@gmail.com> added the comment:
>
> The file contained the following code:
>
> 0x11a3ff119c\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80#%^ciuqrfiqrYWJjMTIzIT8kKiYoKSctPUB-
> abc123!
>
> On Sun, Oct 28, 2018 at 1:35 AM Karthikeyan Singaravelan <
> report@bugs.python.org> wrote:
>
> >
> > Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment:
> >
> > Thanks for the report. Can you please attach the file test.code1? Your
> > original report says "test.code1" is not base64 encoded and -d takes a
> file
> > that is base64 encoded and decodes it. Can you please be more descriptive
> > about what you are expecting?
> >
> > ----------
> > nosy: +xtreak
> >
> > _______________________________________
> > Python tracker <report@bugs.python.org>
> > <https://bugs.python.org/issue35084>
> > _______________________________________
> >
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35084>
> _______________________________________
>
msg328758 - (view) Author: Braden Groom (bradengroom) * Date: 2018-10-28 21:41
The file contents that you've provided aren't valid base64. I think the traceback that you've received is a reasonable one.
msg328765 - (view) Author: TestUser (Tester) Date: 2018-10-28 22:24
Thanks. The Python Foundation asked for users to report bugs. I've done so.

I'm looking at putting this in an article and Tweets on the bug process:
generating bugs, reporting, and resolution.

If I go forward I would like a thought or two from you on this bug process.

Thanks

On Sun, Oct 28, 2018, 5:41 PM Braden Groom <report@bugs.python.org> wrote:

>
> Braden Groom <braden.groom@gmail.com> added the comment:
>
> The file contents that you've provided aren't valid base64. I think the
> traceback that you've received is a reasonable one.
>
> ----------
> nosy: +bradengroom
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35084>
> _______________________________________
>
msg328777 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-10-29 00:42
Can you please add your definition of a crash? Crash in bug report context is used in C language context like causing a segfault, buffer overflow etc. Proper Exceptions are not considered as a crash and this is an exception raised since the contents are invalid. If it crashes as I mentioned above can you please add the crash log?
msg328861 - (view) Author: TestUser (Tester) Date: 2018-10-29 20:03
In the new version of Ubuntu this generates a system crash report. Normally
I delete them.

Give me a day or to to get you one.

Funny, since it is the crash reports use of base64 encoding that led me to
the Python base64 module.

On Sun, Oct 28, 2018 at 8:42 PM Karthikeyan Singaravelan <
report@bugs.python.org> wrote:

>
> Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment:
>
> Can you please add your definition of a crash? Crash in bug report context
> is used in C language context like causing a segfault, buffer overflow etc.
> Proper Exceptions are not considered as a crash and this is an exception
> raised since the contents are invalid. If it crashes as I mentioned above
> can you please add the crash log?
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35084>
> _______________________________________
>
msg329063 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-11-01 13:13
Don't include quoted full messages of other users. Only include quoted fragments if it is absolutely necessary.
msg329064 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-11-01 13:16
@Tester Thanks for the report. I looked at the crash report and I couldn't see CPython crashing with a segfault. I think it's a crash from another application which might be running the interpreter and can't handle the error raised by CPython for invalid data being decoded. This is something the application which crashes has to handle when CPython returns the expected trace back and I don't see any fix from CPython's end. Correct me if I am wrong here.

Relevant CPython trace back : 

PythonArgs: ['/usr/lib/python3.6/base64.py', '-d', 'test.code2']
Traceback:
 Traceback (most recent call last):
   File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
     "__main__", mod_spec)
   File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
     exec(code, run_globals)
   File "/usr/lib/python3.6/base64.py", line 602, in <module>
     main()
   File "/usr/lib/python3.6/base64.py", line 586, in main
     func(f, sys.stdout.buffer)
   File "/usr/lib/python3.6/base64.py", line 512, in decode
     s = binascii.a2b_base64(line)
 binascii.Error: Incorrect padding


Please remove the quoted content while replying from email since it's added to the bug tracker and causes scrolling a little difficult with duplicated content.


Thanks
msg329065 - (view) Author: TestUser (Tester) Date: 2018-11-01 13:18
That is all the crash automator provides.

On Thu, Nov 1, 2018 at 9:13 AM Serhiy Storchaka <report@bugs.python.org>
wrote:

>
> Change by Serhiy Storchaka <storchaka+cpython@gmail.com>:
>
>
> ----------
> Removed message: https://bugs.python.org/msg329061
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35084>
> _______________________________________
>
msg329066 - (view) Author: TestUser (Tester) Date: 2018-11-01 13:31
My guess is the Gnome terminal. It does not like non ASCI data. There are
other programs that generate segfaults in the terminal when piped random
binary data.

Maybe, Python could get a -Q quit setting to turn of the trace back?

Thanks

On Thu, Nov 1, 2018 at 9:18 AM TestUser <report@bugs.python.org> wrote:

>
> TestUser <nullbackslashnull@gmail.com> added the comment:
>
> That is all the crash automator provides.
>
> On Thu, Nov 1, 2018 at 9:13 AM Serhiy Storchaka <report@bugs.python.org>
> wrote:
>
> >
> > Change by Serhiy Storchaka <storchaka+cpython@gmail.com>:
> >
> >
> > ----------
> > Removed message: https://bugs.python.org/msg329061
> >
> > _______________________________________
> > Python tracker <report@bugs.python.org>
> > <https://bugs.python.org/issue35084>
> > _______________________________________
> >
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35084>
> _______________________________________
>
msg329067 - (view) Author: TestUser (Tester) Date: 2018-11-01 13:33
Last thought ...

man base64 has different options than the program:

python3 -m base64 -d -i test.code2
option -i not recognized
usage: /usr/lib/python3.6/base64.py [-d|-e|-u|-t] [file|-]
        -d, -u: decode
        -e: encode (default)
        -t: encode and decode string 'Aladdin:open sesame'

On Thu, Nov 1, 2018 at 9:31 AM Fred Unll <nullbackslashnull@gmail.com>
wrote:

> My guess is the Gnome terminal. It does not like non ASCI data. There are
> other programs that generate segfaults in the terminal when piped random
> binary data.
>
> Maybe, Python could get a -Q quit setting to turn of the trace back?
>
> Thanks
>
>
> On Thu, Nov 1, 2018 at 9:18 AM TestUser <report@bugs.python.org> wrote:
>
>>
>> TestUser <nullbackslashnull@gmail.com> added the comment:
>>
>> That is all the crash automator provides.
>>
>> On Thu, Nov 1, 2018 at 9:13 AM Serhiy Storchaka <report@bugs.python.org>
>> wrote:
>>
>> >
>> > Change by Serhiy Storchaka <storchaka+cpython@gmail.com>:
>> >
>> >
>> > ----------
>> > Removed message: https://bugs.python.org/msg329061
>> >
>> > _______________________________________
>> > Python tracker <report@bugs.python.org>
>> > <https://bugs.python.org/issue35084>
>> > _______________________________________
>> >
>>
>> ----------
>>
>> _______________________________________
>> Python tracker <report@bugs.python.org>
>> <https://bugs.python.org/issue35084>
>> _______________________________________
>>
>
msg329160 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-11-02 20:09
TestUser, please re-read and follow Serhiy's request.
msg329164 - (view) Author: TestUser (Tester) Date: 2018-11-02 20:45
One of the problems reporting is the archaic way the bug trackers work.
Sorry fo the confusion except I am not sure of the exact request.

On my end I have provided what I can. You are welcome to fire up a VM and
run the sample submitted.

All the best.

On Fri, Nov 2, 2018, 4:09 PM Terry J. Reedy <report@bugs.python.org wrote:

>
> Terry J. Reedy <tjreedy@udel.edu> added the comment:
>
> TestUser, please re-read and follow Serhiy's request.
>
> ----------
> nosy: +terry.reedy
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35084>
> _______________________________________
>
History
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79265
2021-09-07 17:15:57iritkatrielsetstatus: open -> closed
resolution: third party
stage: resolved
2018-11-02 20:45:46Testersetmessages: + msg329164
2018-11-02 20:09:24terry.reedysetnosy: + terry.reedy
messages: + msg329160
2018-11-01 13:33:35Testersetmessages: + msg329067
2018-11-01 13:31:30Testersetmessages: + msg329066
2018-11-01 13:18:16Testersetmessages: + msg329065
2018-11-01 13:16:54xtreaksetmessages: + msg329064
2018-11-01 13:13:40serhiy.storchakasetmessages: - msg329061
2018-11-01 13:13:16serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg329063
2018-11-01 13:03:24Testersetfiles: + _usr_lib_python3.6_base64.py.1000.zip

messages: + msg329061
2018-10-29 20:03:30Testersetmessages: + msg328861
2018-10-29 00:42:40xtreaksetmessages: + msg328777
2018-10-28 22:24:21Testersetmessages: + msg328765
2018-10-28 21:41:36bradengroomsetnosy: + bradengroom
messages: + msg328758
2018-10-28 20:08:11Testersetmessages: + msg328735
2018-10-28 19:49:27Testersetmessages: + msg328732
2018-10-28 05:35:03xtreaksetnosy: + xtreak
messages: + msg328674
2018-10-27 23:49:55Testercreate