Keep next_in and avail_in in sync in bz2/lzma/zlib decompressor reset paths
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Bug report
Bug description:
(This was found by Gemini, orchestrated by Dirk Mueller at SUSE)
For https://github.com/advisories/GHSA-pg25-7cx5-cvcm the "next_in" pointers were reset to NULL. However if the decompressor is reused, the "avail_in_real" counter should also be reset to "0" at this time, as if its reused again, next_in and avail_in_real might not be in sync again.
This affects
Modules/_bz2module.c
Modules/_lzmamodule.c
Modules/zlibmodule.c
For bz2, everywhere where next_in is set to NULL, avail_in_real also needs to be set to 0.
++ bzs->next_in = NULL;
should also set
bzs->avail_in_real = 0;
similar for the others.
This is largely hardening. It is not clear if these use cases exist.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Xem xét các đường dẫn reset trong Modules/_bz2module.c, Modules/_lzmamodule.c và Modules/zlibmodule.c, xác định mọi phép gán đặt next_in thành NULL. Xác nhận rằng mỗi lần reset như vậy cũng xóa avail_in_real, sau đó chạy các bài kiểm thử decompressor liên quan và xác minh rằng trạng thái decompressor được tái sử dụng vẫn đồng bộ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, python
- Lĩnh vực
- backend, security
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 62/100