Blame SOURCES/CVE-2019-16167_memory-corruption-due-to-an-integer-overflow.patch
|
|
8c8ee3 |
--- sa_common.c
|
|
|
8c8ee3 |
+++ sa_common.c
|
|
|
8c8ee3 |
@@ -1249,6 +1249,11 @@
|
|
|
8c8ee3 |
/* Remap [unsigned] long fields */
|
|
|
8c8ee3 |
d = gtypes_nr[0] - ftypes_nr[0];
|
|
|
8c8ee3 |
if (d) {
|
|
|
8c8ee3 |
+
|
|
|
8c8ee3 |
+ if (ftypes_nr[0] * ULL_ALIGNMENT_WIDTH < ftypes_nr[0])
|
|
|
8c8ee3 |
+ /* Overflow */
|
|
|
8c8ee3 |
+ return;
|
|
|
8c8ee3 |
+
|
|
|
8c8ee3 |
memmove(((char *) ps) + gtypes_nr[0] * ULL_ALIGNMENT_WIDTH,
|
|
|
8c8ee3 |
((char *) ps) + ftypes_nr[0] * ULL_ALIGNMENT_WIDTH,
|
|
|
8c8ee3 |
st_size - ftypes_nr[0] * ULL_ALIGNMENT_WIDTH);
|
|
|
8c8ee3 |
@@ -1260,7 +1265,13 @@
|
|
|
8c8ee3 |
/* Remap [unsigned] int fields */
|
|
|
8c8ee3 |
d = gtypes_nr[1] - ftypes_nr[1];
|
|
|
8c8ee3 |
if (d) {
|
|
|
8c8ee3 |
- memmove(((char *) ps) + gtypes_nr[0] * ULL_ALIGNMENT_WIDTH
|
|
|
8c8ee3 |
+
|
|
|
8c8ee3 |
+ if (gtypes_nr[0] * ULL_ALIGNMENT_WIDTH +
|
|
|
8c8ee3 |
+ ftypes_nr[1] * UL_ALIGNMENT_WIDTH < ftypes_nr[1])
|
|
|
8c8ee3 |
+ /* Overflow */
|
|
|
8c8ee3 |
+ return;
|
|
|
8c8ee3 |
+
|
|
|
8c8ee3 |
+ memmove(((char *) ps) + gtypes_nr[0] * ULL_ALIGNMENT_WIDTH
|
|
|
8c8ee3 |
+ gtypes_nr[1] * UL_ALIGNMENT_WIDTH,
|
|
|
8c8ee3 |
((char *) ps) + gtypes_nr[0] * ULL_ALIGNMENT_WIDTH
|
|
|
8c8ee3 |
+ ftypes_nr[1] * UL_ALIGNMENT_WIDTH,
|
|
|
8c8ee3 |
@@ -1275,6 +1286,13 @@
|
|
|
8c8ee3 |
/* Remap possible fields (like strings of chars) following int fields */
|
|
|
8c8ee3 |
d = gtypes_nr[2] - ftypes_nr[2];
|
|
|
8c8ee3 |
if (d) {
|
|
|
8c8ee3 |
+
|
|
|
8c8ee3 |
+ if (gtypes_nr[0] * ULL_ALIGNMENT_WIDTH +
|
|
|
8c8ee3 |
+ gtypes_nr[1] * UL_ALIGNMENT_WIDTH +
|
|
|
8c8ee3 |
+ ftypes_nr[2] * U_ALIGNMENT_WIDTH < ftypes_nr[2])
|
|
|
8c8ee3 |
+ /* Overflow */
|
|
|
8c8ee3 |
+ return;
|
|
|
8c8ee3 |
+
|
|
|
8c8ee3 |
memmove(((char *) ps) + gtypes_nr[0] * ULL_ALIGNMENT_WIDTH
|
|
|
8c8ee3 |
+ gtypes_nr[1] * UL_ALIGNMENT_WIDTH
|
|
|
8c8ee3 |
+ gtypes_nr[2] * U_ALIGNMENT_WIDTH,
|