CWE一覧に戻る
CWE-581

オブジェクトモデル違反:イコールとハッシュコードの定義

Object Model Violation: Just One of Equals and Hashcode Defined
脆弱性 レビュー中
JA

この製品は、同じオブジェクトに対して同じハッシュコードを保持しません。

Javaオブジェクトは、等質性に関連する多くの不変量に従うことが期待されている。これらの不変条件の1つは、等しいオブジェクトは等しいハッシュコードを持たなければならないということです。言い換えると、a.equals(b) == trueの場合、a.hashCode() == b.hashCode()となります。

EN

The product does not maintain equal hashcodes for equal objects.

Java objects are expected to obey a number of invariants related to equality. One of these invariants is that equal objects must have equal hashcodes. In other words, if a.equals(b) == true then a.hashCode() == b.hashCode().

Scope: Integrity, Other / Impact: Other
Both Equals() and Hashcode() should be defined.
MITRE公式ページ — CWE-581