projects/guix·blob java-team · refs

98 lines · 3.0 KiB

1From 6f1a3c4648bf06862dca0b3725cbb3b7ee0284e3 Mon Sep 17 00:00:00 2001
2From: Even Rouault <[email protected]>
3Date: Sat, 6 Mar 2021 22:12:27 +0100
4Subject: [PATCH] =?UTF-8?q?gie=5Fself=5Ftests:=20fix=20use=20of=20uninitia?=
5 =?UTF-8?q?lized=20memory=20(fixes=C2=A0#2557)?=
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10---
11 test/unit/gie_self_tests.cpp | 39 ++++++++++++++++++++++--------------
12 1 file changed, 24 insertions(+), 15 deletions(-)
13
14diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp
15index 4244766ebf..92f1c758dc 100644
16--- a/test/unit/gie_self_tests.cpp
17+++ b/test/unit/gie_self_tests.cpp
18@@ -268,8 +268,10 @@ TEST_F(gieTest, proj_create_crs_to_crs) {
19 ASSERT_TRUE(P != nullptr);
20 PJ_COORD a, b;
21
22- a.xy.x = 700000.0;
23- a.xy.y = 6000000.0;
24+ a.xyzt.x = 700000.0;
25+ a.xyzt.y = 6000000.0;
26+ a.xyzt.z = 0;
27+ a.xyzt.t = HUGE_VAL;
28 b.xy.x = 307788.8761171057;
29 b.xy.y = 5999669.3036037628;
30
31@@ -306,8 +308,10 @@ TEST_F(gieTest, proj_create_crs_to_crs_EPSG_4326) {
32 PJ_COORD a, b;
33
34 // Lat, long degrees
35- a.xy.x = 0.0;
36- a.xy.y = 3.0;
37+ a.xyzt.x = 0.0;
38+ a.xyzt.y = 3.0;
39+ a.xyzt.z = 0;
40+ a.xyzt.t = HUGE_VAL;
41
42 b.xy.x = 500000.0;
43 b.xy.y = 0.0;
44@@ -328,8 +332,10 @@ TEST_F(gieTest, proj_create_crs_to_crs_proj_longlat) {
45 PJ_COORD a, b;
46
47 // Long, lat degrees
48- a.xy.x = 3.0;
49- a.xy.y = 0;
50+ a.xyzt.x = 3.0;
51+ a.xyzt.y = 0;
52+ a.xyzt.z = 0;
53+ a.xyzt.t = HUGE_VAL;
54
55 b.xy.x = 500000.0;
56 b.xy.y = 0.0;
57@@ -718,9 +724,10 @@ TEST(gie, proj_create_crs_to_crs_PULKOVO42_ETRS89) {
58 proj_destroy(target_crs);
59
60 // Romania
61- c.xyz.x = 45; // Lat
62- c.xyz.y = 25; // Long
63- c.xyz.z = 0;
64+ c.xyzt.x = 45; // Lat
65+ c.xyzt.y = 25; // Long
66+ c.xyzt.z = 0;
67+ c.xyzt.t = HUGE_VAL;
68 c = proj_trans(P, PJ_FWD, c);
69 EXPECT_NEAR(c.xy.x, 44.999701238, 1e-9);
70 EXPECT_NEAR(c.xy.y, 24.998474948, 1e-9);
71@@ -740,9 +747,10 @@ TEST(gie, proj_create_crs_to_crs_PULKOVO42_ETRS89) {
72 EXPECT_NEAR(c.xy.x, 45, 1e-8);
73 EXPECT_NEAR(c.xy.y, 25, 1e-8);
74
75- c.xyz.x = 45; // Lat
76- c.xyz.y = 25; // Long
77- c.xyz.z = 0;
78+ c.xyzt.x = 45; // Lat
79+ c.xyzt.y = 25; // Long
80+ c.xyzt.z = 0;
81+ c.xyzt.t = HUGE_VAL;
82 proj_trans_generic(P, PJ_FWD, &(c.xyz.x), sizeof(double), 1, &(c.xyz.y),
83 sizeof(double), 1, &(c.xyz.z), sizeof(double), 1,
84 nullptr, 0, 0);
85@@ -783,9 +791,10 @@ TEST(gie, proj_create_crs_to_crs_outside_area_of_use) {
86 EXPECT_EQ(P->fwd, nullptr);
87
88 // Test point outside area of use of both candidate coordinate operations
89- c.xyz.x = 58; // Lat in deg
90- c.xyz.y = 5; // Long in deg
91- c.xyz.z = 0;
92+ c.xyzt.x = 58; // Lat in deg
93+ c.xyzt.y = 5; // Long in deg
94+ c.xyzt.z = 0;
95+ c.xyzt.t = HUGE_VAL;
96 c = proj_trans(P, PJ_FWD, c);
97 EXPECT_NEAR(c.xy.x, 64.44444444444444, 1e-9); // Lat in grad
98 EXPECT_NEAR(c.xy.y, 2.958634259259258, 1e-9); // Long in grad