summaryrefslogtreecommitdiff
path: root/gtk2_ardour/utils_videotl.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-08-22 14:47:19 +0200
committerRobin Gareus <robin@gareus.org>2016-08-22 14:47:37 +0200
commit444b9e89033aa4171254a3622c583e1d791c7e9f (patch)
tree82d17b688eeb4cd9e0d4ab19a88ae13b6060f095 /gtk2_ardour/utils_videotl.cc
parent36f232d5585881d0451f4db9d2037dd1686e9d7a (diff)
Parse information from harvid independent from the locale
This fixes a crash where aspect ratio "0.5" from harvid was interpreted as "0" in the French locale (expecting 0,5). Note: harvid uses a portable, not localized snprintf() implementation
Diffstat (limited to 'gtk2_ardour/utils_videotl.cc')
-rw-r--r--gtk2_ardour/utils_videotl.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk2_ardour/utils_videotl.cc b/gtk2_ardour/utils_videotl.cc
index 684bbf920c..d2bec87d9e 100644
--- a/gtk2_ardour/utils_videotl.cc
+++ b/gtk2_ardour/utils_videotl.cc
@@ -260,6 +260,7 @@ VideoUtils::video_query_info (
double &video_aspect_ratio
)
{
+ LocaleGuard lg;
char url[2048];
snprintf(url, sizeof(url), "%s%sinfo/?file=%s&format=csv"
@@ -282,6 +283,12 @@ VideoUtils::video_query_info (
video_aspect_ratio = atof (lines.at(0).at(3));
video_file_fps = atof (lines.at(0).at(4));
video_duration = atoll(lines.at(0).at(5));
+
+ if (video_aspect_ratio < 0.01 || video_file_fps < 0.01) {
+ /* catch errors early, aspect == 0 or fps == 0 will
+ * wreak havoc down the road */
+ return false;
+ }
return true;
}