소스 검색

Fix insertAuxInitializer may cause inconsistent stack height problem

Usually, constructor only load super class's constructor's init params into stack.
After this() or super() called, stack will be empty. If so, we insertAuxInitializer
right after this() or super() can reuse max stack size if it enough.

But, there is some weird class out there, their constructors load all in-constructor
init field value into stack before this() or super() call. In this case,
after this() or super() call, stack is not empty, even maybe full.

In summary, insertAuxInitializer should increase MaxStack anyway.
tags/rel_3_30_0_ga
shifujun 5 달 전
부모
커밋
2cdc0275b7
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 1
    2
      src/main/javassist/CtClassType.java

+ 1
- 2
src/main/javassist/CtClassType.java 파일 보기

@@ -1763,8 +1763,7 @@ class CtClassType extends CtClass {
int pos = it.insertEx(initializer.get());
it.insert(initializer.getExceptionTable(), pos);
int maxstack = codeAttr.getMaxStack();
if (maxstack < stacksize)
codeAttr.setMaxStack(stacksize);
codeAttr.setMaxStack(maxstack + stacksize);
}

private int makeFieldInitializer(Bytecode code, CtClass[] parameters)

Loading…
취소
저장