From 011fe0d9ba007455077c20f62566d1a661769f1a Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sat, 29 Apr 2023 20:12:42 -0400 Subject: [PATCH] LibGfx/JPEG: Ensure capacity of vector instead of blindly appending --- Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp index 98ab7eb354..bc97b97a44 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp @@ -892,6 +892,7 @@ static ErrorOr read_huffman_table(Stream& stream, JPEGLoadingContext& cont } table.codes.ensure_capacity(total_codes); + table.symbols.ensure_capacity(total_codes); // Read symbols. Read X bytes, where X is the sum of the counts of codes read in the previous step. for (u32 i = 0; i < total_codes; i++) {