Skip to content

Commit c5fc351

Browse files
Validate data in pointer_typet in to_pointer_typet
1 parent 35905c6 commit c5fc351

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/util/std_types.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -1417,8 +1417,9 @@ class pointer_typet:public bitvector_typet
14171417
inline const pointer_typet &to_pointer_type(const typet &type)
14181418
{
14191419
PRECONDITION(type.id()==ID_pointer);
1420-
PRECONDITION(!type.get(ID_width).empty());
1421-
return static_cast<const pointer_typet &>(type);
1420+
const pointer_typet &ret = static_cast<const pointer_typet &>(type);
1421+
validate_type(ret);
1422+
return ret;
14221423
}
14231424

14241425
/*! \copydoc to_pointer_type(const typet &)
@@ -1427,8 +1428,9 @@ inline const pointer_typet &to_pointer_type(const typet &type)
14271428
inline pointer_typet &to_pointer_type(typet &type)
14281429
{
14291430
PRECONDITION(type.id()==ID_pointer);
1430-
PRECONDITION(!type.get(ID_width).empty());
1431-
return static_cast<pointer_typet &>(type);
1431+
pointer_typet &ret = static_cast<pointer_typet &>(type);
1432+
validate_type(ret);
1433+
return ret;
14321434
}
14331435

14341436
template <>

0 commit comments

Comments
 (0)