Matteo Bruni : d3dx9: Avoid overflowing debug channel buffer when tracing ASCII effect errors.

Alexandre Julliard julliard at winehq.org
Sun Jul 3 12:18:29 CDT 2016


Module: wine
Branch: master
Commit: 901c96ef9c86067b748f0e59a19b929e42d6f3b4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=901c96ef9c86067b748f0e59a19b929e42d6f3b4

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Tue Jun 28 19:06:04 2016 +0200

d3dx9: Avoid overflowing debug channel buffer when tracing ASCII effect errors.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/effect.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index fd8d59e..42f5aea 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -5969,7 +5969,22 @@ static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base,
             if (bytecode)
                 ID3D10Blob_Release(bytecode);
             if (temp_errors)
-                TRACE("%s\n", (char *)ID3D10Blob_GetBufferPointer(temp_errors));
+            {
+                const char *error_string = ID3D10Blob_GetBufferPointer(temp_errors);
+                const char *string_ptr;
+
+                while (*error_string)
+                {
+                    string_ptr = error_string;
+                    while (*string_ptr && *string_ptr != '\n' && *string_ptr != '\r'
+                           && string_ptr - error_string < 80)
+                        ++string_ptr;
+                    TRACE("%s\n", debugstr_an(error_string, string_ptr - error_string));
+                    error_string = string_ptr;
+                    while (*error_string == '\n' || *error_string == '\r')
+                        ++error_string;
+                }
+            }
             if (errors)
                 *errors = temp_errors;
             else if (temp_errors)




More information about the wine-cvs mailing list