You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by ar...@apache.org on 2022/06/09 14:16:10 UTC

[systemds] 01/01: [SYSTEMDS-3282] Upper bound for number of decoders

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

arnabp20 pushed a commit to branch branch-2.2.1
in repository https://gitbox.apache.org/repos/asf/systemds.git

commit d7d77dfc0b8ec7164bb3d9db30181aedd185fe14
Author: arnabp <ar...@tugraz.at>
AuthorDate: Wed Feb 2 21:25:08 2022 +0100

    [SYSTEMDS-3282] Upper bound for number of decoders
    
    This patch adds a coherence check on the number of deserialized
    decoders in DecoderComposite object.
    
    Closes #1527.
---
 .../org/apache/sysds/runtime/transform/decode/DecoderComposite.java   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main/java/org/apache/sysds/runtime/transform/decode/DecoderComposite.java b/src/main/java/org/apache/sysds/runtime/transform/decode/DecoderComposite.java
index 7081405735..ca2b370d29 100644
--- a/src/main/java/org/apache/sysds/runtime/transform/decode/DecoderComposite.java
+++ b/src/main/java/org/apache/sysds/runtime/transform/decode/DecoderComposite.java
@@ -83,6 +83,7 @@ public class DecoderComposite extends Decoder
 	public void writeExternal(ObjectOutput out) throws IOException {
 		super.writeExternal(out);
 		out.writeInt(_decoders.size());
+		out.writeInt(_schema == null ? 0:_schema.length); //write #columns
 		for(Decoder decoder : _decoders) {
 			out.writeByte(DecoderFactory.getDecoderType(decoder));
 			decoder.writeExternal(out);
@@ -93,6 +94,9 @@ public class DecoderComposite extends Decoder
 	public void readExternal(ObjectInput in) throws IOException {
 		super.readExternal(in);
 		int decodersSize = in.readInt();
+		int nCols = in.readInt();
+		if (nCols > 0 && decodersSize > nCols*2)
+			throw new IOException("Too many decoders");
 		_decoders = new ArrayList<>();
 		for(int i = 0; i < decodersSize; i++) {
 			Decoder decoder = DecoderFactory.createInstance(in.readByte());