OSDN Git Service

libbinder: Fix out of bounds in readBoolVector
authorChristopher Wiley <wiley@google.com>
Tue, 27 Oct 2015 23:33:47 +0000 (16:33 -0700)
committerChristopher Wiley <wiley@google.com>
Wed, 28 Oct 2015 00:42:32 +0000 (17:42 -0700)
Bug: 25012838
Test: This code now works at runtime.

Change-Id: I3d6b2677f11276e6be4c51451ca36572a4ee573d

libs/binder/Parcel.cpp

index 70e41e3..48bf799 100644 (file)
@@ -1487,8 +1487,8 @@ status_t Parcel::readBoolVector(std::vector<bool>* val) const {
     /* C++ bool handling means a vector of bools isn't necessarily addressable
      * (we might use individual bits)
      */
-    for (int32_t i = 0; i < size; size++) {
-        bool data;
+    bool data;
+    for (int32_t i = 0; i < size; ++i) {
         status = readBool(&data);
         (*val)[i] = data;