Replace the static error string in ZIP_Put_In_Cache0 with on stack memory
Alan Bateman
Alan.Bateman at oracle.com
Tue Apr 10 08:10:42 UTC 2012
On 10/04/2012 08:10, Sean Chou wrote:
>
> And it is found that hotspot calls ZIP_Open through (*ZipOpen) in
> file classLoader.cpp .So I also made a patch for it and add
> hotspot-dev to cc list.
> File classLoader.cpp is the only one I have found calling ZIP_Open.
>
> The webrev for hotspot is:
> http://cr.openjdk.java.net/~zhouyx/7159982/webrev-hotspot.00/
> <http://cr.openjdk.java.net/%7Ezhouyx/7159982/webrev-hotspot.00/>
>
>
> To hotspot guys,
>
> We are trying to make the error path in ZIP_Open
> in src/share/native/java/util/zip/zip_util.c thread safe by changing
> the errbuf[] from static array to on stack array. This will cause the
> returned error string allocated from heap, which need to be freed. I
> checked the code and found only classLoader.cpp calls this function,
> so I made the above webrev. Please take a look.
>
It's good that you spotted that this is called from the VM (I'd
forgotten that). In that case things get a bit more complicated because
the hotspot repository takes a different route into master and also goes
into 7u releases too. I'll leave the HotSpot group to comment on your
proposed change but I assume it will require adding
JDK_Version::is_gte_jdk18x_version so that the JDK version can be tested
before decided whether to free the error message. It will also require a
sponsor as you cannot push changes to jdk8/tl/hotspot, all HotSpot
changes require going through a build+test system (no direct pushes).
-Alan
More information about the core-libs-dev
mailing list