Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

parser/deserializer/ThrowableDeserializer.java 里 deserialze() 可疑的空指针解引用 #1613

Closed
viennadd opened this issue Nov 27, 2017 · 3 comments
Labels
Milestone

Comments

@viennadd
Copy link

viennadd commented Nov 27, 2017

Hi,

我们的代码检查器 Pinpoint 报告了一处可疑的空指针解引用,

if (otherValues != null) {
JavaBeanDeserializer exBeanDeser = null;
if (exClass != null) {
if (exClass == clazz) {
exBeanDeser = this;
} else {
ObjectDeserializer exDeser = parser.getConfig().getDeserializer(exClass);
if (exDeser instanceof JavaBeanDeserializer) {
exBeanDeser = (JavaBeanDeserializer) exDeser;
}
}
}
for (Map.Entry<String, Object> entry : otherValues.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
FieldDeserializer fieldDeserializer = exBeanDeser.getFieldDeserializer(key);
if (fieldDeserializer != null) {

149 行的 exBeanDeser 变量是否有可能跳过全部初始化赋值(139 返回 false 的话) 导致维持 null 值,然后触发空指针解用?

这处是真的有潜在问题?,还是 139 行的检查是非必要?

祝好,
Sourcebrella Inc.

@richardxx
Copy link

阿里大神们麻烦抽空看看,多谢!

wenshao added a commit that referenced this issue Dec 1, 2017
@wenshao wenshao added the bug label Dec 1, 2017
@wenshao wenshao added this to the 1.2.42 milestone Dec 1, 2017
@wenshao
Copy link
Member

wenshao commented Dec 1, 2017

谢谢反馈,问题已经修复,将会在下一版本中带上

@wenshao
Copy link
Member

wenshao commented Dec 14, 2017

https://github.com/alibaba/fastjson/releases/tag/1.2.42
新版已发布,请使用新版本。

@wenshao wenshao closed this as completed Dec 14, 2017
wenshao added a commit that referenced this issue Jan 1, 2018
wenshao added a commit that referenced this issue Jul 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants