From 6881b2c5cb8b824b9c16a1e7e0035c6dfb874a4c Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 13 Feb 2011 18:05:19 -0800 Subject: Added proper error about broken 0-values for enums. --- src/upb_def.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/upb_def.c b/src/upb_def.c index 7e962c8..879f1e8 100644 --- a/src/upb_def.c +++ b/src/upb_def.c @@ -476,6 +476,12 @@ static upb_flow_t upb_enumdef_EnumValueDescriptorProto_value(void *_b, break; case GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NUMBER_FIELDNUM: b->number = upb_value_getint32(val); + if (b->number == 0) { + upb_seterr(&b->status, UPB_ERROR, + "Enums with a value of 0 are currently broken; see " + "http://code.google.com/p/upb/issues/detail?id=1."); + return UPB_BREAK; + } b->saw_number = true; break; default: -- cgit v1.2.3