diff OrthancServer/ParsedDicomFile.cpp @ 1981:4b545a8b1f95

return code in Toolbox::DecodeDataUriScheme
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Apr 2016 09:05:06 +0200
parents ebce5f456b8e
children b5d4f9c156ad
line wrap: on
line diff
--- a/OrthancServer/ParsedDicomFile.cpp	Fri Apr 22 08:57:33 2016 +0200
+++ b/OrthancServer/ParsedDicomFile.cpp	Fri Apr 22 09:05:06 2016 +0200
@@ -635,7 +635,11 @@
         boost::starts_with(utf8Value, "data:application/octet-stream;base64,"))
     {
       std::string mime;
-      Toolbox::DecodeDataUriScheme(mime, binary, utf8Value);
+      if (!Toolbox::DecodeDataUriScheme(mime, binary, utf8Value))
+      {
+        throw OrthancException(ErrorCode_BadFileFormat);
+      }
+
       decoded = &binary;
     }
     else
@@ -911,7 +915,11 @@
   void ParsedDicomFile::EmbedContent(const std::string& dataUriScheme)
   {
     std::string mime, content;
-    Toolbox::DecodeDataUriScheme(mime, content, dataUriScheme);
+    if (!Toolbox::DecodeDataUriScheme(mime, content, dataUriScheme))
+    {
+      throw OrthancException(ErrorCode_BadFileFormat);
+    }
+
     Toolbox::ToLowerCase(mime);
 
     if (mime == "image/png" ||