Diewalkure / owasp-esapi-java

Automatically exported from code.google.com/p/owasp-esapi-java
Other
1 stars 0 forks source link

HTMLEntityCodec static data can initialized multiple times, possibly deadlocking #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The static maps in HTMLEntityCodec are initialized in the constructor even 
though they could be in a static initializer for thread-safe guaranteed 
once-only initialization.

When this is coupled with issue 142, the system can ultimately end up with 
multiple threads updating the same HashMap without any synchronization which 
can lead to many problems, including a 100% CPU livelock if multiple threads 
rehash the HashMap at the same time.

A patch is attached which moves this code into a static initializer.

Original issue reported on code.google.com by patrick....@gmail.com on 26 Aug 2010 at 12:41

Attachments:

GoogleCodeExporter commented 9 years ago
We made many changes to this class, do they solve this issue?

Original comment by manico.james@gmail.com on 1 Nov 2010 at 1:13

GoogleCodeExporter commented 9 years ago
Patrick, these maps are no longer loaded in the constructor, they are 
sychronized, and return unmodifiable maps. please reopen if you still think 
this is an issue.

Original comment by manico.james@gmail.com on 1 Nov 2010 at 1:14