facebook / facebook/zstd

COVER_selectDict() uses stale customDictContentEnd after ZDICT_finalizeDictionary modifies dictContentSize

Offen
#4,750 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C
Sterne
27.9k
Forks
2.6k
Ø Merge
1 T. 3 Std.
Gemergte PRs (30 T.)
8

Beschreibung

**Describe the bug**
In `lib/dictBuilder/cover.c`, `COVER_selectDict()` computes `customDictContentEnd` at line 1055 based on the initial `dictContentSize`,Then at line 1069, `ZDICT_finalizeDictionary()` is called and its **return value** overwrites `dictContentSize`,ZDICT_finalizeDictionary()` returns the actual dictionary size after adding the header, which can differ from the input `dictContentSize`. However, `customDictContentEnd` is **never updated** to reflect the new `dictContentSize`.

**To Reproduce**
The currently public API cannot easily trigger this bug, but the bug does exist in the code logic.

**Expected behavior**
Update `customDictContentEnd` after `ZDICT_finalizeDictionary()` modifies `dictContentSize`.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.