[ 
https://issues.apache.org/jira/browse/OPENNLP-1899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Zowalla closed OPENNLP-1899.
------------------------------------
    Resolution: Fixed

> Harden SymSpell model deserialization against oversized count fields
> --------------------------------------------------------------------
>
>                 Key: OPENNLP-1899
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1899
>             Project: OpenNLP
>          Issue Type: Improvement
>    Affects Versions: 3.0.0-M5
>            Reporter: Richard Zowalla
>            Assignee: Richard Zowalla
>            Priority: Major
>             Fix For: 3.0.0-M6
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> SymSpellModelSerializer.create() reads unigramCount and bigramCount as 32-bit 
> ints
> from the binary model stream and passes them straight to
> LinkedHashMap.newLinkedHashMap(...), guarded only against negative values.
> A crafted .bin model declaring Integer.MAX_VALUE pre-sizes the map to 2^30 
> entries;
> the first put() then allocates a 4-8 GB backing array and the JVM dies with
> OutOfMemoryError. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to