non-zero enumerator lint error crash
We can't lint this code (get ValueString) when the enum is malformed, so
avoiding the lint in that case.
Fixes: 176228954
Test: fuzzer w/ added corpus entry
Change-Id: I2cba891b96227363bcd8b929fa21c70b58f4b516
diff --git a/aidl_language.cpp b/aidl_language.cpp
index be5b7ab..ea6f5c2 100644
--- a/aidl_language.cpp
+++ b/aidl_language.cpp
@@ -1260,6 +1260,8 @@
success = success && enumerator->CheckValid(GetBackingType());
}
+ if (!success) return false; // ValueString requires valid type
+
AIDL_FATAL_IF(GetEnumerators().empty(), this)
<< "The enum '" << GetName() << "' has no enumerators.";
@@ -1271,7 +1273,7 @@
<< first_value << ".";
}
- return success;
+ return true;
}
void AidlEnumDeclaration::Dump(CodeWriter* writer) const {
@@ -1583,4 +1585,4 @@
return unresolved_name;
}
return canonical_name;
-}
\ No newline at end of file
+}