|
|
71ed48 |
These issues were found by Coverity static analysis tool
|
|
|
71ed48 |
|
|
|
71ed48 |
Error: DEADCODE (CWE-561): [#def3]
|
|
|
71ed48 |
gd-2.0.35/gd.c:3494: cond_cannot_single: Condition "dx == 0L", taking false branch. Now the value of "dx" cannot be equal to 0.
|
|
|
71ed48 |
gd-2.0.35/gd.c:3502: cannot_single: At condition "dx == 0L", the value of "dx" cannot be equal to 0.
|
|
|
71ed48 |
gd-2.0.35/gd.c:3502: dead_error_condition: The condition "dx == 0L" cannot be true.
|
|
|
71ed48 |
gd-2.0.35/gd.c:3502: dead_error_line: Execution cannot reach this expression "dy == 0L" inside statement "if (dx == 0L && dy == 0L){
|
|
|
71ed48 |
...".
|
|
|
71ed48 |
|
|
|
71ed48 |
Error: DEADCODE (CWE-561): [#def4]
|
|
|
71ed48 |
gd-2.0.35/gd.c:1085: cond_cannot_single: Condition "dx == 0", taking false branch. Now the value of "dx" cannot be equal to 0.
|
|
|
71ed48 |
gd-2.0.35/gd.c:1097: cannot_single: At condition "dx == 0", the value of "dx" cannot be equal to 0.
|
|
|
71ed48 |
gd-2.0.35/gd.c:1097: dead_error_condition: The condition "dx == 0" cannot be true.
|
|
|
71ed48 |
gd-2.0.35/gd.c:1097: dead_error_line: Execution cannot reach this expression "dy == 0" inside statement "if (dx == 0 && dy == 0){
|
|
|
71ed48 |
...".
|
|
|
71ed48 |
|
|
|
71ed48 |
|
|
|
71ed48 |
diff -up gd-2.0.35/gd.c.sa1 gd-2.0.35/gd.c
|
|
|
71ed48 |
--- gd-2.0.35/gd.c.sa1 2012-12-05 16:23:09.289667430 +0100
|
|
|
71ed48 |
+++ gd-2.0.35/gd.c 2012-12-05 16:30:41.634854587 +0100
|
|
|
71ed48 |
@@ -1094,11 +1094,6 @@ BGD_DECLARE(void) gdImageLine (gdImagePt
|
|
|
71ed48 |
{
|
|
|
71ed48 |
/* More-or-less horizontal. use wid for vertical stroke */
|
|
|
71ed48 |
/* Doug Claar: watch out for NaN in atan2 (2.0.5) */
|
|
|
71ed48 |
- if ((dx == 0) && (dy == 0))
|
|
|
71ed48 |
- {
|
|
|
71ed48 |
- wid = 1;
|
|
|
71ed48 |
- }
|
|
|
71ed48 |
- else
|
|
|
71ed48 |
{
|
|
|
71ed48 |
/* 2.0.12: Michael Schwartz: divide rather than multiply;
|
|
|
71ed48 |
TBB: but watch out for /0! */
|
|
|
71ed48 |
@@ -3490,6 +3485,12 @@ static void gdImageAALine (gdImagePtr im
|
|
|
71ed48 |
dx = x2 - x1;
|
|
|
71ed48 |
dy = y2 - y1;
|
|
|
71ed48 |
|
|
|
71ed48 |
+ if (dx == 0 && dy == 0) {
|
|
|
71ed48 |
+ /* TBB: allow setting points */
|
|
|
71ed48 |
+ gdImageSetAAPixelColor(im, x1, y1, col, 0xFF);
|
|
|
71ed48 |
+ return;
|
|
|
71ed48 |
+ }
|
|
|
71ed48 |
+
|
|
|
71ed48 |
/* Axis aligned lines */
|
|
|
71ed48 |
if (dx == 0) {
|
|
|
71ed48 |
gdImageVLine(im, x1, y1, y2, col);
|
|
|
71ed48 |
@@ -3499,12 +3500,7 @@ static void gdImageAALine (gdImagePtr im
|
|
|
71ed48 |
return;
|
|
|
71ed48 |
}
|
|
|
71ed48 |
|
|
|
71ed48 |
- if (dx == 0 && dy == 0) {
|
|
|
71ed48 |
- /* TBB: allow setting points */
|
|
|
71ed48 |
- gdImageSetAAPixelColor(im, x1, y1, col, 0xFF);
|
|
|
71ed48 |
- return;
|
|
|
71ed48 |
- }
|
|
|
71ed48 |
- else {
|
|
|
71ed48 |
+ {
|
|
|
71ed48 |
double ag;
|
|
|
71ed48 |
if (abs(dy) < abs(dx))
|
|
|
71ed48 |
ag = cos (atan2 (dy, dx));
|