vcl/source/filter/GraphicFormatDetector.cxx |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit f9eacf3d535e3dac7c1f30a5f74f4ff7a77a94be
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Sep 6 09:30:36 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Sep 10 14:28:39 2025 +0200

    tdf#168265: pass comment (999) section to detect dxf file
    
    Change-Id: I6d54e4dcc578792bd122e24743f41c0049974a2a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190632
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    (cherry picked from commit b5044aa84af207dc44944c9ad51847b50e7f43b1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190653
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index 75d52c9c841c..a8d4858026c5 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -1150,6 +1150,30 @@ bool GraphicFormatDetector::checkDXF()
         ++i;
     }
 
+    // tdf#168265: pass comment section which begins with 999
+    // see 
https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-3F0380A5-1C15-464D-BC66-2C5F094BCFB9
+    if (i < 256 - 2 && maFirstBytes[i] == '9' && maFirstBytes[i + 1] == '9'
+        && maFirstBytes[i + 2] == '9')
+    {
+        // we're on the 999 line
+        i = i + 3;
+        // we want to pass this line
+        while (i < 256 && maFirstBytes[i] <= 32)
+        {
+            ++i;
+        }
+        // we're on the comment line and we want to go until new line
+        while (i < 256 && maFirstBytes[i] != 10)
+        {
+            ++i;
+        }
+        // we're on the new line
+        while (i < 256 && maFirstBytes[i] <= 32)
+        {
+            ++i;
+        }
+    }
+
     if (i < 256 && maFirstBytes[i] == '0')
     {
         ++i;

Reply via email to