Skip to content

Checking len bounds after usage in bytesio.c #131505

Closed
@naya451

Description

@naya451

In _io_BytesIO_readinto_impl() len value is used in memcpy and then checked for being positive.
It's better to move assertions before memcpy.

This may be done with the following commit: da720c1

Linked PRs

Activity

corona10

corona10 commented on Mar 20, 2025

@corona10
Member

Sounds reasonable please submit the patch.

changed the title [-]Checking len bounds after usage[/-] [+]Checking len bounds after usage in bytesio.c[/+] on Mar 24, 2025
added a commit that references this issue on May 19, 2025

gh-131505: Move len boundary assertions before using len. (#131536)

c45e661
added a commit that references this issue on May 19, 2025

pythongh-131505: Move len boundary assertions before using len. (pyth…

gpshead

gpshead commented on May 19, 2025

@gpshead
Member

thanks!

added a commit that references this issue on May 20, 2025

[3.14] gh-131505: Move len boundary assertions before using len. (GH-…

ccaf865
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Checking len bounds after usage in bytesio.c · Issue #131505 · python/cpython

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant