mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-31 01:05:42 +00:00
premature end of tag detection
DefineMorphShape2 fix
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2013 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class EndOfStreamException extends RuntimeException {
|
||||
|
||||
public EndOfStreamException() {
|
||||
super("Premature end of the stream reached");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -185,7 +185,11 @@ public class SWFInputStream extends InputStream {
|
||||
lastPercent = percent;
|
||||
}
|
||||
}
|
||||
return is.read();
|
||||
int r = is.read();
|
||||
if (r == -1) {
|
||||
throw new EndOfStreamException();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1393,7 +1397,13 @@ public class SWFInputStream extends InputStream {
|
||||
*/
|
||||
public Action readAction(ReReadableInputStream rri) throws IOException {
|
||||
{
|
||||
int actionCode = readUI8();
|
||||
int actionCode = -1;
|
||||
|
||||
try{
|
||||
actionCode=readUI8();
|
||||
}catch(EndOfStreamException eos){
|
||||
return null;
|
||||
}
|
||||
if (actionCode == 0) {
|
||||
return new ActionEnd();
|
||||
}
|
||||
@@ -2576,7 +2586,9 @@ public class SWFInputStream extends InputStream {
|
||||
*/
|
||||
public MORPHGRADIENT readMORPHGRADIENT() throws IOException {
|
||||
MORPHGRADIENT ret = new MORPHGRADIENT();
|
||||
int numGradients = (int) readUI8();
|
||||
int numGradients = (int) readUI8();
|
||||
numGradients = numGradients % 8; //there should be 1 to 8 but sometimes there is more. This modulo seems to be OK.
|
||||
|
||||
ret.gradientRecords = new MORPHGRADRECORD[numGradients];
|
||||
for (int i = 0; i < numGradients; i++) {
|
||||
ret.gradientRecords[i] = readMORPHGRADRECORD();
|
||||
|
||||
Reference in New Issue
Block a user