Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
4.1.2, 4.1.3, 4.1.4, 4.2.0
-
None
-
aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
-
Compiler Warning
Description
The cast from mbstate_t* to unsigned short* in iso2022.cpp and subsequently dereferencing the pointer is unsafe because we don't know the alignment requirement of mbstate_t and because the type itself might be smaller that unsigned short, including as small as plain char as happens to be the case on IRIX.
aCC -c -mt -I$(TOPDIR)/include -I$(BUILDDIR)/include -AA +O2 +DD64 +w \ +W392 +W655 +W684 +W818 +W819 +W849 +W2193 +W2236 +W2261 \ +W2340 +W2401 +W2487 +W4227 +W4229 +W4231 +W4235 +W4237 \ +W4249 +W4255 +W4272 +W4284 +W4285 +W4286 +Z $(TOPDIR)/src/iso2022.cpp "$(TOPDIR)/src/iso2022.cpp", line 472: warning #4232-D: conversion from "mbstate_t *" to a more strictly aligned type "unsigned short *" may cause misaligned access _RWSTD_REINTERPRET_CAST (ISO_2022_STATE_INDEX_T*, &state); ^ "$(TOPDIR)/src/iso2022.cpp", line 766, procedure __rw::__rw_iso2022jp_designate: warning #20200-D: Potential null pointer dereference through esc is detected (null definition:$(TOPDIR)/src/iso2022.cpp, line 679) "$(TOPDIR)/src/iso2022.cpp", line 1543, procedure __rw::__rw_ucs4_to_interm: warning #20206-D: Out of bound access (buffer "db_array" byte range is [0 - 11], access range at [0 - 23]) "$(TOPDIR)/src/iso2022.cpp", line 1588, procedure __rw::__rw_ucs4_to_interm: warning #20206-D: Out of bound access (buffer "db_array" byte range is [0 - 11], access range at [0 - 23])