Fix for package version validation 28/132728/2
authorPiotr Ganicz <p.ganicz@samsung.com>
Wed, 7 Jun 2017 09:37:55 +0000 (11:37 +0200)
committerPiotr Ganicz <p.ganicz@samsung.com>
Wed, 7 Jun 2017 09:40:17 +0000 (11:40 +0200)
Change-Id: I19c5df406396608aed5d214c82914d67a01a0c35

src/wgt_manifest_handlers/tizen_application_handler.cc

index 83c2fd803eb5cd994f1ee15fc89670d10cb41b2b..e566fc511eae3205d83d7beffb5b7708f0037987 100644 (file)
@@ -88,6 +88,10 @@ bool TizenApplicationHandler::Parse(
     if (!value.empty()) {
       utils::VersionNumber req_version(value);
       utils::VersionNumber min_version = parser::GetMinimumPlatformVersion();
+      if (!req_version.IsValidTizenPackageVersion()) {
+        *error = "Provided package version is invalid.\n";
+        return false;
+      }
       if (req_version < min_version) {
         app_info->set_required_version(min_version.ToString());
       } else {
@@ -150,12 +154,12 @@ bool TizenApplicationHandler::Validate(
   }
   utils::VersionNumber supported_version = parser::GetCurrentPlatformVersion();
   if (!supported_version.IsValid()) {
-    *error = "Cannot retrieve supported API version from platform";
+    *error = "Cannot retrieve supported API version from platform.\n";
     return false;
   }
   utils::VersionNumber required_version(app_info.required_version());
   if (!required_version.IsValid()) {
-    *error = "Cannot retrieve supported API version from widget";
+    *error = "Cannot retrieve supported API version from widget.\n";
     return false;
   }
   if (supported_version < required_version) {