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/02/02 20:31:40 UTC

[systemds] branch main updated: [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 main
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/main by this push:
     new eb0e6a5  [SYSTEMDS-3282] Upper bound for number of decoders
eb0e6a5 is described below

commit eb0e6a562c4281064d27f057fe0d88407d89b7de
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 7081405..ca2b370 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());