]> git.sesse.net Git - casparcg/commitdiff
2.0. layer: Fixed potential arethmetic overflows.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 25 Aug 2011 11:21:38 +0000 (11:21 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 25 Aug 2011 11:21:38 +0000 (11:21 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1283 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

core/producer/layer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp

index 7ef42e9fe9875fa6cdf08b4bc1a799e3c84d1bee..f940d2a9eb6bda491fa0253bc9b376dcbc47fa50 100644 (file)
@@ -40,7 +40,7 @@ public:
                : foreground_(frame_producer::empty())\r
                , background_(frame_producer::empty())\r
                , frame_number_(0)\r
-               , auto_play_delta_(std::numeric_limits<int>::min())\r
+               , auto_play_delta_(-1)\r
                , is_paused_(false)\r
        {\r
        }\r
@@ -77,7 +77,7 @@ public:
                        foreground_                     = background_;\r
                        background_                     = frame_producer::empty();\r
                        frame_number_           = 0;\r
-                       auto_play_delta_        = std::numeric_limits<int>::min();      \r
+                       auto_play_delta_        = -1;   \r
                }\r
 \r
                is_paused_                      = false;\r
@@ -88,7 +88,7 @@ public:
                foreground_                     = frame_producer::empty();\r
                background_                     = background_;\r
                frame_number_           = 0;\r
-               auto_play_delta_        = std::numeric_limits<int>::min();\r
+               auto_play_delta_        = -1;\r
 \r
                is_paused_                      = true;\r
        }\r
@@ -105,7 +105,7 @@ public:
                                return foreground_->last_frame();\r
 \r
                        auto frames_left = foreground_->nb_frames() - (++frame_number_) - auto_play_delta_;\r
-                       if(frames_left < 1)\r
+                       if(auto_play_delta_ > -1 && frames_left < 1)\r
                        {\r
                                play();\r
                                return receive();\r
index 839e35a1d02611da708a264500fb65994da7515c..3db902f5fe64b8e93776972bebce1a95e3de7e65 100644 (file)
@@ -172,7 +172,7 @@ public:
        virtual int64_t nb_frames() const \r
        {\r
                if(loop_)\r
-                       return std::numeric_limits<int>::max();\r
+                       return std::numeric_limits<int64_t>::max();\r
 \r
                // This function estimates nb_frames until input has read all packets for one loop, at which point the count should be accurate.\r
 \r