docker/patch/0282-backport-fix-CVE-2024-36623.patch
zhongjiawei 96638540d5 docker:fix CVE-2024-36623
(cherry picked from commit bac17d509e0e29a47e18ba9950b23a4069b3713b)
2024-12-06 14:49:35 +08:00

49 lines
1.6 KiB
Diff

From 5e02d7625ef0472e0be29acb30e47255546ced58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= <pawel.gronowski@docker.com>
Date: Thu, 22 Feb 2024 18:01:40 +0100
Subject: [PATCH] pkg/streamformatter: Make `progressOutput` concurrency safe
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Sync access to the underlying `io.Writer` with a mutex.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
---
components/engine/pkg/streamformatter/streamformatter.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/components/engine/pkg/streamformatter/streamformatter.go b/components/engine/pkg/streamformatter/streamformatter.go
index 04917d49ab..eaa82e1010 100644
--- a/components/engine/pkg/streamformatter/streamformatter.go
+++ b/components/engine/pkg/streamformatter/streamformatter.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
+ "sync"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/progress"
@@ -109,6 +110,7 @@ type progressOutput struct {
sf formatProgress
out io.Writer
newLines bool
+ mu sync.Mutex
}
// WriteProgress formats progress information from a ProgressReader.
@@ -120,6 +122,9 @@ func (out *progressOutput) WriteProgress(prog progress.Progress) error {
jsonProgress := jsonmessage.JSONProgress{Current: prog.Current, Total: prog.Total, HideCounts: prog.HideCounts, Units: prog.Units}
formatted = out.sf.formatProgress(prog.ID, prog.Action, &jsonProgress, prog.Aux)
}
+
+ out.mu.Lock()
+ defer out.mu.Unlock()
_, err := out.out.Write(formatted)
if err != nil {
return err
--
2.33.0