Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0154405

Browse files
authored
gh-104282: Fix null pointer dereference inlzma._decode_filter_properties (GH-104283)
1 parentb204c4b commit0154405

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

‎Lib/test/test_lzma.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,14 @@ def test__decode_filter_properties(self):
14011401
self.assertEqual(filterspec["lc"],3)
14021402
self.assertEqual(filterspec["dict_size"],8<<20)
14031403

1404+
# see gh-104282
1405+
filters= [lzma.FILTER_X86,lzma.FILTER_POWERPC,
1406+
lzma.FILTER_IA64,lzma.FILTER_ARM,
1407+
lzma.FILTER_ARMTHUMB,lzma.FILTER_SPARC]
1408+
forfinfilters:
1409+
filterspec=lzma._decode_filter_properties(f,b"")
1410+
self.assertEqual(filterspec, {"id":f})
1411+
14041412
deftest_filter_properties_roundtrip(self):
14051413
spec1=lzma._decode_filter_properties(
14061414
lzma.FILTER_LZMA1,b"]\x00\x00\x80\x00")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix null pointer dereference in:func:`lzma._decode_filter_properties`
2+
due to improper handling of BCJ filters with properties of zero length.
3+
Patch by Radislav Chugunov.

‎Modules/_lzmamodule.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,9 @@ build_filter_spec(const lzma_filter *f)
492492
caseLZMA_FILTER_ARMTHUMB:
493493
caseLZMA_FILTER_SPARC: {
494494
lzma_options_bcj*options=f->options;
495-
ADD_FIELD(options,start_offset);
495+
if (options) {
496+
ADD_FIELD(options,start_offset);
497+
}
496498
break;
497499
}
498500
default:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp