From 913345d239e7aa67bfbfb80e8d1f2394c5de64c4 Mon Sep 17 00:00:00 2001 From: Jeffrey Evan Hammerbacher Date: Fri, 4 Jun 2010 00:58:49 +0000 Subject: [PATCH] Merge r951231 from trunk to 1.3 branch. Fixes: AVRO-559. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.3@951232 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ lang/py/src/avro/io.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 201ff167d0d..3ee354b3a8b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,9 @@ Avro 1.3.3 (Unreleased) AVRO-560. Python impl should include system errors in every protocol (hammer) + AVRO-559. Handle read_union error where the list index of the union branch + to follow exceeds the size of the union schema (hammer) + BUG FIXES AVRO-496. python sample_http_client.py is broken (Jeff Hodges via hammer) diff --git a/lang/py/src/avro/io.py b/lang/py/src/avro/io.py index ff2ba24faf9..55e15639b17 100644 --- a/lang/py/src/avro/io.py +++ b/lang/py/src/avro/io.py @@ -606,6 +606,10 @@ def read_union(self, writers_schema, readers_schema, decoder): """ # schema resolution index_of_schema = int(decoder.read_long()) + if index_of_schema >= len(writers_schema.schemas): + fail_msg = "Can't access branch index %d for union with %d branches"\ + % (index_of_schema, writers_schema.schemas) + raise SchemaResolutionException(fail_msg, writers_schema, readers_schema) selected_writers_schema = writers_schema.schemas[index_of_schema] # read data