Commit 2c49f52
authored
Port "improve _gdImageFillTiled() internal function" (GH-17356)
This improvement was done for libgd 2.1.0[1], and the erroneous
calculation has been fixed as of libgd 2.2.0[2].
While we're at it we also add the overflow checks of external libgd;
these are not really necessary, since `.sx * .sy` overflow was already
prevented when the image has been created, and since we're using
`safe_emalloc()` the `struct seg` overflow is also prevented. It
should be noted that `overflow2()` prevents `int` overflow, while
`safe_emalloc()` prevents `size_t` overflow, so the former is more
restrictive. For parity with external libgd, this still appears to be
a good thing.
[1] <libgd/libgd@86a5deb>
[2] <libgd/libgd@e87ec88>1 parent d20880c commit 2c49f52
1 file changed
+23
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2026 | 2026 | | |
2027 | 2027 | | |
2028 | 2028 | | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
2029 | 2037 | | |
2030 | 2038 | | |
2031 | 2039 | | |
| |||
2073 | 2081 | | |
2074 | 2082 | | |
2075 | 2083 | | |
2076 | | - | |
| 2084 | + | |
2077 | 2085 | | |
2078 | 2086 | | |
2079 | 2087 | | |
2080 | 2088 | | |
2081 | 2089 | | |
2082 | | - | |
| 2090 | + | |
2083 | 2091 | | |
2084 | 2092 | | |
2085 | 2093 | | |
| |||
2089 | 2097 | | |
2090 | 2098 | | |
2091 | 2099 | | |
2092 | | - | |
2093 | | - | |
2094 | | - | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
2095 | 2106 | | |
2096 | 2107 | | |
| 2108 | + | |
| 2109 | + | |
2097 | 2110 | | |
2098 | 2111 | | |
2099 | 2112 | | |
| |||
2105 | 2118 | | |
2106 | 2119 | | |
2107 | 2120 | | |
2108 | | - | |
| 2121 | + | |
2109 | 2122 | | |
2110 | | - | |
| 2123 | + | |
2111 | 2124 | | |
2112 | 2125 | | |
2113 | 2126 | | |
| |||
2121 | 2134 | | |
2122 | 2135 | | |
2123 | 2136 | | |
2124 | | - | |
| 2137 | + | |
2125 | 2138 | | |
2126 | | - | |
| 2139 | + | |
2127 | 2140 | | |
2128 | 2141 | | |
2129 | 2142 | | |
| |||
2132 | 2145 | | |
2133 | 2146 | | |
2134 | 2147 | | |
2135 | | - | |
| 2148 | + | |
2136 | 2149 | | |
2137 | 2150 | | |
2138 | 2151 | | |
2139 | 2152 | | |
2140 | | - | |
2141 | | - | |
2142 | | - | |
2143 | | - | |
2144 | 2153 | | |
2145 | 2154 | | |
2146 | 2155 | | |
| |||
0 commit comments