Fix memory corruption in TGlslIoMapper
authorTimo Suoranta <timo.suoranta@hatch.live>
Sun, 2 Feb 2020 09:31:49 +0000 (11:31 +0200)
committerTimo Suoranta <timo.suoranta@hatch.live>
Sun, 2 Feb 2020 09:31:49 +0000 (11:31 +0200)
glslang/MachineIndependent/iomapper.h

index 933e259..13a8932 100644 (file)
@@ -261,10 +261,10 @@ public:
 class TGlslIoMapper : public TIoMapper {
 public:
     TGlslIoMapper() {
-        memset(inVarMaps,     0, sizeof(TVarLiveMap*)   * (EShLangCount + 1));
-        memset(outVarMaps,    0, sizeof(TVarLiveMap*)   * (EShLangCount + 1));
-        memset(uniformVarMap, 0, sizeof(TVarLiveMap*)   * (EShLangCount + 1));
-        memset(intermediates, 0, sizeof(TIntermediate*) * (EShLangCount + 1));
+        memset(inVarMaps,     0, sizeof(TVarLiveMap*)   * EShLangCount);
+        memset(outVarMaps,    0, sizeof(TVarLiveMap*)   * EShLangCount);
+        memset(uniformVarMap, 0, sizeof(TVarLiveMap*)   * EShLangCount);
+        memset(intermediates, 0, sizeof(TIntermediate*) * EShLangCount);
     }
     virtual ~TGlslIoMapper() {
         for (size_t stage = 0; stage < EShLangCount; stage++) {