You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2024/06/10 22:22:56 UTC

(royale-compiler) 02/02: NoCRLFInputStream: fix three argument read(), which iterated through a temp byte[] using a wrong starting index

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit bc55e66be86672d3f62e196ccdc7ee4cfc15ac15
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Jun 10 15:22:41 2024 -0700

    NoCRLFInputStream: fix three argument read(), which iterated through a temp byte[] using a wrong starting index
    
    It started at off, which is based on the b.length, but temp was created with a length of len, which can be smaller because it omits everything before off, which might not be 0.
    
    Fix for workaround in commit apache/royale-compiler@275c354
---
 .../java/org/apache/royale/compiler/filespecs/FileSpecification.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/filespecs/FileSpecification.java b/compiler-common/src/main/java/org/apache/royale/compiler/filespecs/FileSpecification.java
index 91dd0536f..3993e5414 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/filespecs/FileSpecification.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/filespecs/FileSpecification.java
@@ -206,14 +206,14 @@ public class FileSpecification extends BaseFileSpecification implements IBinaryF
 		public int read(byte[] b, int off, int len) throws IOException
 		{
 			byte[] temp = new byte[len];
-			int retval = super.read(temp, off, len);
+			int retval = super.read(temp, 0, len);
 			if (retval == -1)
 				return -1;
 			if (retval == 0)
 				return 0;
 			
 			int j = 0;
-			for (int i = off; i < retval; i++)
+			for (int i = 0; i < retval; i++)
 			{
 				byte c = temp[i];
 				if (c == '\r')