From a7a5eee369599f7e08168a0d766b3522ef79ea97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E8=BF=8E=E6=9C=9D?= Date: Mon, 6 Mar 2023 16:48:03 +0000 Subject: [PATCH] cefclient: Fix incorrect logic in PassThruResponseFilter --- tests/cefclient/browser/response_filter_test.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/cefclient/browser/response_filter_test.cc b/tests/cefclient/browser/response_filter_test.cc index 70e8f54ac..4e2e2434a 100644 --- a/tests/cefclient/browser/response_filter_test.cc +++ b/tests/cefclient/browser/response_filter_test.cc @@ -191,11 +191,12 @@ class PassThruResponseFilter : public CefResponseFilter { DCHECK_GT(data_out_size, 0U); DCHECK_EQ(data_out_written, 0U); - // All data will be read. - data_in_read = data_in_size; - // Write out the contents unchanged. - data_out_written = std::min(data_in_read, data_out_size); + data_out_written = std::min(data_in_size, data_out_size); + + // All data will be read. + data_in_read = data_out_written; + if (data_out_written > 0) { memcpy(data_out, data_in, data_out_written); }