[hibernate-commits] [hibernate/hibernate-orm] 35037d: HHH-13259 Fix StackOverflowError in StringHelper

Dmitriy Levin noreply at github.com
Wed Aug 14 05:54:45 EDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/hibernate/hibernate-orm
  Commit: 35037dac7b6e080c7d1dae31a64d0d5012b1b40c
      https://github.com/hibernate/hibernate-orm/commit/35037dac7b6e080c7d1dae31a64d0d5012b1b40c
  Author: Legohuman <legohuman at gmail.com>
  Date:   2019-08-14 (Wed, 14 Aug 2019)

  Changed paths:
    M hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java
    M hibernate-core/src/test/java/org/hibernate/test/util/StringHelperTest.java

  Log Message:
  -----------
  HHH-13259 Fix StackOverflowError in StringHelper

Before fix method org.hibernate.internal.util.StringHelper#replace
matched placeholders illegally in case when ordinal parameters list was
expanded. Ex. placeholder ?1 was matched with ?11, ?12, ?13 etc. For
queries with 2 or more IN clauses with different collections there were
a situation when ?1 from the first clause matched with already expanded
placeholders from the second collection. Each match led to recursive
call of replace method. If collection in second clause was very long
then StackOverflowError occurred.

Fix adds check of partial placeholder match for wholeWords mode which
is used in expanding list parameters. Partial matches are skipped
during replace.




More information about the hibernate-commits mailing list