From e7bcad327814a78ecb8d5f5545d2e3df84c67a5c Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 5 Jul 2015 14:23:59 +0000 Subject: Vendor import of clang trunk r241361: https://llvm.org/svn/llvm-project/cfe/trunk@241361 --- lib/StaticAnalyzer/Core/BasicValueFactory.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/StaticAnalyzer/Core/BasicValueFactory.cpp') diff --git a/lib/StaticAnalyzer/Core/BasicValueFactory.cpp b/lib/StaticAnalyzer/Core/BasicValueFactory.cpp index 0e90566..3c3f41a 100644 --- a/lib/StaticAnalyzer/Core/BasicValueFactory.cpp +++ b/lib/StaticAnalyzer/Core/BasicValueFactory.cpp @@ -154,9 +154,13 @@ BasicValueFactory::evalAPSInt(BinaryOperator::Opcode Op, return &getValue( V1 * V2 ); case BO_Div: + if (V2 == 0) // Avoid division by zero + return nullptr; return &getValue( V1 / V2 ); case BO_Rem: + if (V2 == 0) // Avoid division by zero + return nullptr; return &getValue( V1 % V2 ); case BO_Add: -- cgit v1.1