Repository navigation
Backup: меньше копий буферов импорта и экспорта - #499
Merged
Merged
Conversation
Read archives with a hard limit into one exactly sized buffer and hand it to the import session without another copy. Export serializes into a bounded pooled buffer after the header and encrypts in place; a cheap lower bound rejects oversized payloads before any buffer is allocated. Decryption uses a pooled plaintext buffer cleared on every path. The v1 format, limit, AES-GCM, PBKDF2 and AAD are unchanged. Closes #394
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #394
Что сделано
BackupArchive.ReadFileAsync: для потока с известной длиной — один буфер точного размера после проверки лимита (плюс проверка, что файл не изменился при чтении); для неизвестной длины — геометрический рост, но не большеMaximumFileSize + 1.OpenImportOwnedпередаёт прочитанный массив сессии без повторного копирования; сессия очищает его при Dispose.SettingsViewModel.OpenBackupбольше не делаетMemoryStream.ToArray().BoundedBuffer) и шифрует на месте. Лимит проверяется во время записи; дешёвая нижняя оценка размера отклоняет заведомо большие архивы до выделения буферов. Буферы с plaintext очищаются перед возвратом в пул.Тесты
Как проверено
scripts/env.ps1сBYDLO_SAFE_DEV=1; движки, туннели и системная сеть не запускались.