From 359663b6f37b3fa0700126ad50ce78bc799add74 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Fri, 20 Nov 2020 16:43:24 +0100
Subject: [PATCH] [MatL/S] Fix a bug in MCASAnisotropic in 2D case.

Out of bounds access in the 2D case.
---
 .../MFront/MohrCoulombAbboSloanAniso.mfront          | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/MaterialLib/SolidModels/MFront/MohrCoulombAbboSloanAniso.mfront b/MaterialLib/SolidModels/MFront/MohrCoulombAbboSloanAniso.mfront
index b4390b716df..217f83e9bd4 100644
--- a/MaterialLib/SolidModels/MFront/MohrCoulombAbboSloanAniso.mfront
+++ b/MaterialLib/SolidModels/MFront/MohrCoulombAbboSloanAniso.mfront
@@ -96,7 +96,11 @@ cs.setEntryName("ShearFactor");
     const int step = sig.size() + 1;
     Hill[0] = cn;
     Hill[step] = Hill[step * 2] = 1. / cn;
-    Hill[step * 3] = Hill[step * 4] = cs;
+    Hill[step * 3] = cs;
+    if (step == 7)  // 3D case
+    {
+        Hill[step * 5] = cs;
+    }
 
     // Compute initial elastic strain
     const auto S = invert(D);
@@ -146,7 +150,11 @@ cs.setEntryName("ShearFactor");
     const int step = sig.size() + 1;
     Hill[0] = cn;
     Hill[step] = Hill[step * 2] = 1. / cn;
-    Hill[step * 3] = Hill[step * 4] = cs;
+    Hill[step * 3] = cs;
+    if (step == 7)  // 3D case
+    {
+        Hill[step * 5] = cs;
+    }
     if (F)
     {
         const auto sig_scaled = Hill * sig;
-- 
GitLab