Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ jobs:
uses: actions/checkout@v7

- name: Initialize CodeQL
uses: github/codeql-action/init@v4.38.1
uses: github/codeql-action/init@v4.38.2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql.yml
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v4.38.1
uses: github/codeql-action/autobuild@v4.38.2
if: ${{ matrix.language == 'python' || matrix.language == 'javascript' }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4.38.1
uses: github/codeql-action/analyze@v4.38.2
with:
category: "/language:${{ matrix.language }}"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ repos:
- id: pyupgrade
args: ['--py37-plus']
- repo: https://github.com/PyCQA/flake8
rev: '7.3.0'
rev: '7.4.1'
hooks:
- id: flake8
additional_dependencies:
Expand Down
6 changes: 6 additions & 0 deletions CHANGES/13758.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Fixed a crash in :meth:`~aiohttp.BodyPartReader.read_chunk` on a body part
with an explicit ``Content-Length: 0``: the part fell through to the
streaming read strategy, whose minimum chunk size assertion then failed for
chunk sizes below the boundary length. Such parts now yield an immediate
empty chunk, like any other part with a known length
-- by :user:`istoolsfox`.
1 change: 1 addition & 0 deletions CHANGES/13760.bugfix.rst
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Illia Volochii
Ilya Chichak
Ilya Gruzinov
Ingmar Steen
istoolsfox
Ivan Lakovic
Ivan Larin
J. Nick Koston
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ async def read_chunk(self, size: int = chunk_size) -> bytes:
if carry:
self._b64_carry = b""
want = max(want, self._boundary_len)
if self._length:
if self._length is not None:
fresh = await self._read_chunk_from_length(want)
else:
fresh = await self._read_chunk_from_stream(want)
Expand Down
4 changes: 2 additions & 2 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pip-tools==7.6.1
# via -r requirements/dev.in
pkgconfig==1.6.0
# via -r requirements/test-common-base.in
platformdirs==4.11.12
platformdirs==4.11.14
# via virtualenv
pluggy==1.6.0
# via
Expand Down Expand Up @@ -336,7 +336,7 @@ uvloop==0.22.1 ; platform_system != "Windows"
# -r requirements/lint.in
valkey==6.1.1
# via -r requirements/lint.in
virtualenv==21.9.1
virtualenv==21.12.1
# via pre-commit
wheel==0.48.0
# via pip-tools
Expand Down
4 changes: 2 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pip-tools==7.6.1
# via -r requirements/dev.in
pkgconfig==1.6.0
# via -r requirements/test-common-base.in
platformdirs==4.11.12
platformdirs==4.11.14
# via virtualenv
pluggy==1.6.0
# via
Expand Down Expand Up @@ -326,7 +326,7 @@ uvloop==0.22.1 ; platform_system != "Windows" and implementation_name == "cpytho
# -r requirements/lint.in
valkey==6.1.1
# via -r requirements/lint.in
virtualenv==21.9.1
virtualenv==21.12.1
# via pre-commit
wheel==0.48.0
# via pip-tools
Expand Down
4 changes: 2 additions & 2 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ packaging==26.3
# via pytest
pathspec==1.1.1
# via mypy
platformdirs==4.11.12
platformdirs==4.11.14
# via virtualenv
pluggy==1.6.0
# via pytest
Expand Down Expand Up @@ -166,7 +166,7 @@ uvloop==0.22.1 ; platform_system != "Windows"
# via -r requirements/lint.in
valkey==6.1.1
# via -r requirements/lint.in
virtualenv==21.9.1
virtualenv==21.12.1
# via pre-commit
yarl==1.25.1
# via aiohttp
Expand Down
8 changes: 8 additions & 0 deletions tests/test_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ async def test_read_chunk_without_content_length(self) -> None:
assert c1 + c2 == b"Hello, world!"
assert c3 == b""

async def test_read_chunk_with_zero_content_length(self) -> None:
with Stream(b"\r\n--:--\r\n") as stream:
d = HeadersDictProxy(CIMultiDict({"Content-Length": "0"}))
obj = aiohttp.BodyPartReader(BOUNDARY, d, stream)
result = await obj.read_chunk(4)
assert obj.at_eof()
assert b"" == result

async def test_read_incomplete_chunk(self) -> None:
with Stream(b"") as stream:

Expand Down
Loading