Skip to content

Commit 6280abc

Browse files
Validate data in pointer_typet in to_pointer_typet
1 parent fdc45e7 commit 6280abc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/util/std_types.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,8 +1389,9 @@ class pointer_typet:public bitvector_typet
13891389
inline const pointer_typet &to_pointer_type(const typet &type)
13901390
{
13911391
PRECONDITION(type.id()==ID_pointer);
1392-
PRECONDITION(!type.get(ID_width).empty());
1393-
return static_cast<const pointer_typet &>(type);
1392+
const pointer_typet &ret = static_cast<const pointer_typet &>(type);
1393+
validate_type(ret);
1394+
return ret;
13941395
}
13951396

13961397
/*! \copydoc to_pointer_type(const typet &)
@@ -1399,8 +1400,9 @@ inline const pointer_typet &to_pointer_type(const typet &type)
13991400
inline pointer_typet &to_pointer_type(typet &type)
14001401
{
14011402
PRECONDITION(type.id()==ID_pointer);
1402-
PRECONDITION(!type.get(ID_width).empty());
1403-
return static_cast<pointer_typet &>(type);
1403+
pointer_typet &ret = static_cast<pointer_typet &>(type);
1404+
validate_type(ret);
1405+
return ret;
14041406
}
14051407

14061408
template<> inline bool can_cast_type<pointer_typet>(const typet &type)

0 commit comments

Comments
 (0)