vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx |    5 ++---
 vcl/source/filter/itiff/itiff.cxx                  |    7 +++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 1577c0dc30ed3c9db361fb989e41a3e9d6c45dfa
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Jun 1 20:24:22 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jun 2 10:01:14 2022 +0200

    tdf#149418 the expectation is on success the tiff stream pos is at EOF
    
    which is what the old one did, so do that here as well, libtiff will
    leave the stream some other pos by default, presumably the directory.
    
    which explains the testTdf138818 mystery
    
    Change-Id: I574700f81a21ee164d9911e05e2023aa48d10370
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135279
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx 
b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
index d4fdeea43524..72f12ca565f5 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
@@ -113,7 +113,6 @@ void TiffFilterTest::testTdf115863()
     CPPUNIT_ASSERT_EQUAL(tools::Long(618), aSize.Height());
 }
 
-//TODO-check if this is still correct, looks ok, but what was it testing 
exactly
 void TiffFilterTest::testTdf138818()
 {
     OUString aURL = getUrl() + "tdf138818.tif";
@@ -126,9 +125,9 @@ void TiffFilterTest::testTdf138818()
     CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
 
     // Without the fix in place, this test would have failed with
-    // - Expected: 45953
+    // - Expected: 46428
     // - Actual  : 45951
-    CPPUNIT_ASSERT_EQUAL(sal_uInt32(45953), 
aGraphic.GetGfxLink().GetDataSize());
+    CPPUNIT_ASSERT_EQUAL(sal_uInt32(46428), 
aGraphic.GetGfxLink().GetDataSize());
 }
 
 void TiffFilterTest::testTdf74331()
diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index 672ef92d902a..1a7e48d1a3e9 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -113,6 +113,8 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
     if (!tif)
         return false;
 
+    const auto nOrigPos = rTIFF.Tell();
+
     Animation aAnimation;
 
     do
@@ -246,9 +248,14 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
             rGraphic = aAnimation.GetBitmapEx();
         else
             rGraphic = aAnimation;
+
+        // seek to end of TIFF if succeeded
+        rTIFF.Seek(STREAM_SEEK_TO_END);
+
         return true;
     }
 
+    rTIFF.Seek(nOrigPos);
     return false;
 }
 

Reply via email to