Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@dcreager dcreager authored
Showing with 10 additions and 0 deletions.
  1. +3 −0  CHANGES.txt
  2. +7 −0 lang/c/src/value-read.c
View
3  CHANGES.txt
@@ -64,6 +64,9 @@ Avro 1.7.2 (unreleased)
AVRO-1158. C: Fixed infinite loop in deflate decompression codec.
(Lucas Martin-King via dcreager)
+ AVRO-1159. C: Check union discriminants in avro_value_read.
+ (Lucas Martin-King via dcreager)
+
Avro 1.7.1 (16 July 2012)
NEW FEATURES
View
7 lang/c/src/value-read.c
@@ -165,6 +165,13 @@ read_union_value(avro_reader_t reader, avro_value_t *dest)
check_prefix(rval, avro_binary_encoding.
read_long(reader, &discriminant),
"Cannot read union discriminant: ");
+
+ if (discriminant < 0) {
+ avro_set_error("Invalid union discriminant value: (%d)",
+ discriminant);
+ return 1;
+ }
+
check(rval, avro_value_set_branch(dest, discriminant, &branch));
check(rval, read_value(reader, &branch));
return 0;
Please sign in to comment.
Something went wrong with that request. Please try again.