Skip to content

Add reverse_rows option to bitmaptools.readinto #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 41 commits into from

Conversation

kmatch98
Copy link

This is added helper for loading graphics BMP files where the rows are reversed, adding a reverse_rows input parameter to bitmaptools.readinto. This supports updates to the adafruit_imageload library.

Observed a speedup of about 4x when loading the purple.bmp: https://cdn-learn.adafruit.com/assets/assets/000/074/681/original/purple.bmp?1555717198

gamblor21 and others added 28 commits March 11, 2021 19:32
Currently translated at 80.3% (783 of 975 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/
Currently translated at 98.8% (964 of 975 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/
Currently translated at 100.0% (975 of 975 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/
Currently translated at 99.4% (969 of 974 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/
Currently translated at 44.4% (433 of 974 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/it/
Currently translated at 100.0% (974 of 974 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/
Currently translated at 100.0% (974 of 974 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/
امير محمد العمري and others added 2 commits March 16, 2021 16:42
Currently translated at 100.0% (974 of 974 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/
@kmatch98
Copy link
Author

Build is failing for:

E: The repository 'https://dl.bintray.com/sbt/debian  Release' is no longer signed.

No ideas how to resolve this one....

Copy link
Owner

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jepler
Copy link
Owner

jepler commented Mar 17, 2021

Oh look, conflicts. Do you want to wait on adding this until after the original PR gets merged? Due to the addition of auto code formatting, the code all got changed out from under us. Progress!

@kmatch98
Copy link
Author

No problem at all. I’ll await for when the PR gets merged and figure out how to merge this into that.

@kmatch98
Copy link
Author

Moved to here: adafruit#4428

@kmatch98 kmatch98 closed this Mar 19, 2021
jepler pushed a commit that referenced this pull request May 5, 2021
jepler added a commit that referenced this pull request May 10, 2021
asan considers that memcmp(p, q, N) is permitted to access N bytes at
each of p and q, even for values of p and q that have a difference
earlier.  Accessing additional values is frequently done in practice,
reading 4 or more bytes from each input at a time for efficiency, so
when completing "non_exist<TAB>" in the repl, this causes a diagnostic:

```
==16938==ERROR: AddressSanitizer: global-buffer-overflow on address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fffffffd1d0
READ of size 9 at 0x555555cd8dc8 thread T0
    #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
    #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
    #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/readline.c:225
    #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
    #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/unix/main.c:194
    adafruit#5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/main.c:673
    adafruit#6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/main.c:436
    adafruit#7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
    adafruit#8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/unix/micropython-coverage+0x40bd69)

0x555555cd8dc8 is located 0 bytes to the right of global variable 'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of size 8
  'import_str' is ascii string 'import '
SUMMARY: AddressSanitizer: global-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
Shadow bytes around the buggy address:
  0x0aab2ab93160: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0aab2ab93170: 05 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0aab2ab93180: 06 f9 f9 f9 f9 f9 f9 f9 06 f9 f9 f9 f9 f9 f9 f9
  0x0aab2ab93190: 05 f9 f9 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
  0x0aab2ab931a0: 00 00 00 00 00 00 00 00 04 f9 f9 f9 f9 f9 f9 f9
=>0x0aab2ab931b0: 00 00 00 00 00 00 00 00 00[f9]f9 f9 f9 f9 f9 f9
  0x0aab2ab931c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2ab931d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2ab931e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 f9
  0x0aab2ab931f0: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 f9 f9 f9
  0x0aab2ab93200: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
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
==16938==ABORTING
```
jepler added a commit that referenced this pull request May 10, 2021
asan considers that memcmp(p, q, N) is permitted to access N bytes at
each of p and q, even for values of p and q that have a difference
earlier.  Accessing additional values is frequently done in practice,
reading 4 or more bytes from each input at a time for efficiency, so
when completing "non_exist<TAB>" in the repl, this causes a diagnostic:

```
==16938==ERROR: AddressSanitizer: global-buffer-overflow on address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fffffffd1d0
READ of size 9 at 0x555555cd8dc8 thread T0
    #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
    #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
    #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/readline.c:225
    #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
    #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/unix/main.c:194
    adafruit#5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/main.c:673
    adafruit#6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/main.c:436
    adafruit#7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
    adafruit#8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/unix/micropython-coverage+0x40bd69)

0x555555cd8dc8 is located 0 bytes to the right of global variable 'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of size 8
  'import_str' is ascii string 'import '
SUMMARY: AddressSanitizer: global-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
Shadow bytes around the buggy address:
  0x0aab2ab93160: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0aab2ab93170: 05 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0aab2ab93180: 06 f9 f9 f9 f9 f9 f9 f9 06 f9 f9 f9 f9 f9 f9 f9
  0x0aab2ab93190: 05 f9 f9 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
  0x0aab2ab931a0: 00 00 00 00 00 00 00 00 04 f9 f9 f9 f9 f9 f9 f9
=>0x0aab2ab931b0: 00 00 00 00 00 00 00 00 00[f9]f9 f9 f9 f9 f9 f9
  0x0aab2ab931c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2ab931d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2ab931e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 f9
  0x0aab2ab931f0: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 f9 f9 f9
  0x0aab2ab93200: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
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
==16938==ABORTING
```

Signed-off-by: Jeff Epler <jepler@gmail.com>
jepler added a commit that referenced this pull request May 10, 2021
asan considers that memcmp(p, q, N) is permitted to access N bytes at
each of p and q, even for values of p and q that have a difference
earlier.  Accessing additional values is frequently done in practice,
reading 4 or more bytes from each input at a time for efficiency, so
when completing "non_exist<TAB>" in the repl, this causes a diagnostic:

```
==16938==ERROR: AddressSanitizer: global-buffer-overflow on
address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
READ of size 9 at 0x555555cd8dc8 thread T0
    #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
    #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
    #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
    #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
    #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
    adafruit#5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
    adafruit#6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
    adafruit#7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
    adafruit#8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

0x555555cd8dc8 is located 0 bytes to the right of global variable
'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
size 8
  'import_str' is ascii string 'import '
```

Signed-off-by: Jeff Epler <jepler@gmail.com>
jepler added a commit that referenced this pull request May 10, 2021
asan considers that memcmp(p, q, N) is permitted to access N bytes at
each of p and q, even for values of p and q that have a difference
earlier.  Accessing additional values is frequently done in practice,
reading 4 or more bytes from each input at a time for efficiency, so
when completing "non_exist<TAB>" in the repl, this causes a diagnostic:

```
==16938==ERROR: AddressSanitizer: global-buffer-overflow on
address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
READ of size 9 at 0x555555cd8dc8 thread T0
    #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
    #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
    #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
    #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
    #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
    adafruit#5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
    adafruit#6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
    adafruit#7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
    adafruit#8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

0x555555cd8dc8 is located 0 bytes to the right of global variable
'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
size 8
  'import_str' is ascii string 'import '
```

Signed-off-by: Jeff Epler <jepler@gmail.com>
jepler added a commit that referenced this pull request Jun 8, 2021
asan considers that memcmp(p, q, N) is permitted to access N bytes at each
of p and q, even for values of p and q that have a difference earlier.
Accessing additional values is frequently done in practice, reading 4 or
more bytes from each input at a time for efficiency, so when completing
"non_exist<TAB>" in the repl, this causes a diagnostic:

    ==16938==ERROR: AddressSanitizer: global-buffer-overflow on
    address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
    READ of size 9 at 0x555555cd8dc8 thread T0
        #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
        #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
        #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
        #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
        #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
        adafruit#5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
        adafruit#6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
        adafruit#7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
        adafruit#8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

    0x555555cd8dc8 is located 0 bytes to the right of global variable
    'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
    size 8
      'import_str' is ascii string 'import '

Signed-off-by: Jeff Epler <jepler@gmail.com>
jepler pushed a commit that referenced this pull request Mar 17, 2023
Pull in the latest main branch from adafruit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.