From 6b67f8ec81b4811dbad35c982c51e769eda67133 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 5 Mar 2015 14:14:19 +0100 Subject: [PATCH] Fix possible AttributeMap corruption on double removal Motivation: When remove0() is called multiple times for an DefaultAttribute it can cause corruption of the internal linked-list structure. Modifications: - Ensure remove0() can not cause corruption by null out prev and next references. Result: No more corruption possible --- common/src/main/java/io/netty/util/DefaultAttributeMap.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/src/main/java/io/netty/util/DefaultAttributeMap.java b/common/src/main/java/io/netty/util/DefaultAttributeMap.java index 2cd6d4a9e9..f136e232e5 100644 --- a/common/src/main/java/io/netty/util/DefaultAttributeMap.java +++ b/common/src/main/java/io/netty/util/DefaultAttributeMap.java @@ -172,6 +172,11 @@ public class DefaultAttributeMap implements AttributeMap { if (next != null) { next.prev = prev; } + + // Null out prev and next - this will guard against multiple remove0() calls which may corrupt + // the linked list for the bucket. + prev = null; + next = null; } } }