Bug 298502 - infinite loop in MercatorProjection.cpp
Summary: infinite loop in MercatorProjection.cpp
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian unstable Linux
: NOR normal
Target Milestone: 1.4 (KDE 4.9)
Assignee: marble-bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-20 19:16 UTC by Sune Vuorela
Modified: 2012-05-17 11:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Vuorela 2012-04-20 19:16:39 UTC
in a custom app built on libmarble, I've hit a infiinte loop in MercatorProjection.cpp

Reproducible: Sometimes

Steps to Reproduce:
build a my secret app and run it
Actual Results:  
infinite loop in ~75% of the cases

Expected Results:  
no infinite loop

in MercatorProjection.cpp in the function
231 bool MercatorProjection::geoCoordinates( const int x, const int y,                                                                                                                                                                                       

236     const int radius = viewport->radius(); // can be null in our case

244     const qreal pixel2Rad = M_PI / (2 * radius); // pixel2Rad is now infinity

249         lon = xPixels * pixel2Rad + centerLon; // lon is now infinity

251         while ( lon > M_PI )  lon -= 2*M_PI; // inf-=2*M_PI is still inf and > M_PI

loops forever there.

line numbers is based on current HEAD which is v4.7.95-484-ga4626c0

bug observed with marble 4.7.4 but code looks still the same
Comment 1 Dennis Nienhüser 2012-05-17 11:38:28 UTC
Git commit 6e0eaeb455a1d52ec413587cb277acd6214706c6 by Dennis Nienhüser.
Committed on 17/05/2012 at 13:36.
Pushed by nienhueser into branch 'master'.

Require positive radii, ignore other.

M  +1    -0    src/lib/Projections/MercatorProjection.cpp
M  +5    -3    src/lib/ViewportParams.cpp
M  +6    -1    src/lib/ViewportParams.h
M  +11   -0    tests/MercatorProjectionTest.cpp
M  +8    -0    tests/ProjectionTest.cpp

http://commits.kde.org/marble/6e0eaeb455a1d52ec413587cb277acd6214706c6