Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

AVRO-1159. C: Check union discriminant in avro_value_read.

Contributed by Lucas Martin-King.


git-svn-id: https://svn.apache.org/repos/asf/avro/trunk@1384543 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 124ed638b1472e67fd0efc21a5b2b77bedb78d35 1 parent b854359
Douglas Creager authored September 13, 2012
3  CHANGES.txt
@@ -64,6 +64,9 @@ Avro 1.7.2 (unreleased)
64 64
     AVRO-1158. C: Fixed infinite loop in deflate decompression codec.
65 65
     (Lucas Martin-King via dcreager)
66 66
 
  67
+    AVRO-1159. C: Check union discriminants in avro_value_read.
  68
+    (Lucas Martin-King via dcreager)
  69
+
67 70
 Avro 1.7.1 (16 July 2012)
68 71
 
69 72
   NEW FEATURES
7  lang/c/src/value-read.c
@@ -165,6 +165,13 @@ read_union_value(avro_reader_t reader, avro_value_t *dest)
165 165
 	check_prefix(rval, avro_binary_encoding.
166 166
 		     read_long(reader, &discriminant),
167 167
 		     "Cannot read union discriminant: ");
  168
+
  169
+	if (discriminant < 0) {
  170
+		avro_set_error("Invalid union discriminant value: (%d)",
  171
+			       discriminant);
  172
+		return 1;
  173
+	}
  174
+
168 175
 	check(rval, avro_value_set_branch(dest, discriminant, &branch));
169 176
 	check(rval, read_value(reader, &branch));
170 177
 	return 0;

0 notes on commit 124ed63

Please sign in to comment.
Something went wrong with that request. Please try again.