You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2009/01/29 17:52:32 UTC

DO NOT REPLY [Bug 46627] New: offset of new pictures is sometimes wrong

https://issues.apache.org/bugzilla/show_bug.cgi?id=46627

           Summary: offset of new pictures is sometimes wrong
           Product: POI
           Version: 3.2-FINAL
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSLF
        AssignedTo: dev@poi.apache.org
        ReportedBy: erwin94@gmx.net


Hi,

after images have been removed from a powerpoint file, they are sometimes not
really deleted. This causes the calculation of the offset in
SlideShow.addPicture to fail. Attached is a patch that bases the calculation on
the actual data contained in the file.

HTH, David.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46627] offset of new pictures is sometimes wrong

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46627





--- Comment #3 from David <er...@gmx.net>  2009-02-01 08:30:41 PST ---
Sorry, I am having trouble reproducing this problem on a new ppt file. The one
that causes problems for me I cannot submit because of company policy, but this
happened before on several files, so this does not seem to be an isolated
incident. I will try again to reproduce the problem when I have more time (in
about a week or so).

bye, David.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46627] offset of new pictures is sometimes wrong

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46627





--- Comment #4 from Yegor Kozlov <ye...@dinom.ru>  2009-02-01 08:49:05 PST ---
I suspect it can be reproduced with PictureTypeZero.ppt or
PictureLengthZero.ppt from our collection of test files:

http://svn.apache.org/repos/asf/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/

Can check it and post sample code that causes the problem? 

These two files contain invalid images, the first one contains images with
unknown type=0, the second one contains images with zero length, i.e. only
header and no data.

Yegor


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46627] offset of new pictures is sometimes wrong

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46627





--- Comment #2 from Yegor Kozlov <ye...@dinom.ru>  2009-01-30 06:01:55 PST ---
Can you attach a problem ppt file with removed images? The suggested fix looks
good but I don't want to commit it without a unit test.

Thanks,
Yegor


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46627] offset of new pictures is sometimes wrong

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46627





--- Comment #5 from David <er...@gmx.net>  2009-02-09 04:58:50 PST ---
You are correct, PictureLengthZero.ppt exposes the problem. Simply adding any
picture, like the following code does, should result in an invalid image in the
resulting ppt:

   SlideShow ppt = new SlideShow( new ByteArrayInputStream( readFile( args[ 0 ]
) ) );

   int index = ppt.addPicture( readFile( args[ 1 ] ), Picture.PNG );
   Picture picture = new Picture( index );
   ppt.getSlides()[0].addShape( picture );

   ByteArrayOutputStream result = new ByteArrayOutputStream();
   ppt.write( result );

   FileOutputStream os = new FileOutputStream( "output.ppt" );
   os.write( result.toByteArray() );
   os.close();

readFile is a simple function that returns the bytes contained in a file. After
applying the patch this works for me.


bye, David.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46627] offset of new pictures is sometimes wrong

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46627


Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #6 from Yegor Kozlov <ye...@dinom.ru>  2009-02-10 11:55:36 PST ---
Fixed in r743080 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=743080 )
Thanks,
Yegor


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46627] offset of new pictures is sometimes wrong

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46627





--- Comment #1 from David <er...@gmx.net>  2009-01-29 08:53:23 PST ---
Created an attachment (id=23193)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23193)
patch that fixes the problem for me.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org