ASF Bugzilla – Attachment 20047 Details for
Bug 42255
[PATCH] Infinite loop reading WMF file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to fix the issue
infinite-loop-fix.patch (text/plain), 1.67 KB, created by
Trejkaz (pen name)
on 2007-04-25 18:22:12 UTC
(
hide
)
Description:
Patch to fix the issue
Filename:
MIME Type:
Creator:
Trejkaz (pen name)
Created:
2007-04-25 18:22:12 UTC
Size:
1.67 KB
patch
obsolete
>Index: sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java >=================================================================== >--- sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java (revision 532555) >+++ sources/org/apache/batik/transcoder/wmf/tosvg/AbstractWMFReader.java (working copy) >@@ -24,7 +24,6 @@ > import java.awt.geom.Rectangle2D; > import java.io.DataInputStream; > import java.io.IOException; >-import java.io.InputStream; > import java.util.List; > import java.util.ArrayList; > >@@ -76,27 +75,13 @@ > } > > /** >- * ALWAYS expect to get less than the requested number of bytes from a read(). >- * @param buff is filled from is >- * @param is inputStream >- * @throws IOException from is.read() >- */ >- private void fillBytes( byte[] buff, InputStream is ) throws IOException { >- int expected = buff.length; >- int nRead = 0; >- do{ >- nRead += is.read( buff, nRead, expected - nRead ); >- } while ( nRead < expected ); >- } >- >- /** > * Read the next short ( 2 bytes) value in the DataInputStream. > * we cant use is.readShort() because of different byte-order. > */ > protected short readShort( DataInputStream is ) throws IOException { > > byte[] js = new byte[ 2 ]; >- fillBytes( js, is ); >+ is.readFully( js ); > > return (short) (((js[ 1 ] << 8)) & 0xff00 | (js[0] & 0x00ff)); > } >@@ -108,7 +93,7 @@ > protected int readInt( DataInputStream is ) throws IOException { > > byte[] js = new byte[ 4 ]; >- fillBytes( js, is ); >+ is.readFully( js ); > > return ( 0xff & js[ 3 ] ) << 24 > | ( 0xff & js[ 2 ] ) << 16
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 42255
:
20046
| 20047