From 91f0dbc9ec60e1e047d227f5780c477622544442 Mon Sep 17 00:00:00 2001 From: Amulya Kumar Sahoo Date: Fri, 30 May 2014 11:44:50 +0530 Subject: [PATCH 1/4] Fix of a bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stream::find(char *target) passes NULL as “terminator” to Stream::findUntil(char *target, char *terminator), which immediately dereferences it by passing it on to strlen(): bool Stream::find(char *target) { return findUntil(target, NULL); } // as find but search ends if the terminator string is found bool Stream::findUntil(char *target, char *terminator) { return findUntil(target, strlen(target), terminator, strlen(terminator)); } --- hardware/arduino/cores/arduino/Stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/Stream.cpp b/hardware/arduino/cores/arduino/Stream.cpp index aafb7fcf9..f21a411f8 100644 --- a/hardware/arduino/cores/arduino/Stream.cpp +++ b/hardware/arduino/cores/arduino/Stream.cpp @@ -75,7 +75,7 @@ void Stream::setTimeout(unsigned long timeout) // sets the maximum number of mi // find returns true if the target string is found bool Stream::find(char *target) { - return findUntil(target, NULL); + return findUntil(target, ""); } // reads data from the stream until the target string of given length is found From 2c3058b2d5ae889feacde25880464dce84a5e1fd Mon Sep 17 00:00:00 2001 From: Amulya Kumar Sahoo Date: Fri, 30 May 2014 11:47:08 +0530 Subject: [PATCH 2/4] Fix of a bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stream::find(char *target) passes NULL as “terminator” to Stream::findUntil(char *target, char *terminator), which immediately dereferences it by passing it on to strlen() : bool Stream::find(char *target) { return findUntil(target, NULL); } // as find but search ends if the terminator string is found bool Stream::findUntil(char *target, char *terminator) { return findUntil(target, strlen(target), terminator, strlen(terminator)); } --- hardware/arduino/cores/robot/Stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/robot/Stream.cpp b/hardware/arduino/cores/robot/Stream.cpp index aafb7fcf9..f21a411f8 100644 --- a/hardware/arduino/cores/robot/Stream.cpp +++ b/hardware/arduino/cores/robot/Stream.cpp @@ -75,7 +75,7 @@ void Stream::setTimeout(unsigned long timeout) // sets the maximum number of mi // find returns true if the target string is found bool Stream::find(char *target) { - return findUntil(target, NULL); + return findUntil(target, ""); } // reads data from the stream until the target string of given length is found From e6923526d3d9ed28427e8beecb4f3b5bf2f87775 Mon Sep 17 00:00:00 2001 From: Amulya Kumar Sahoo Date: Sat, 7 Jun 2014 18:05:04 +0530 Subject: [PATCH 3/4] Fixed error in comment --- libraries/Robot_Control/Melody.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/Robot_Control/Melody.cpp b/libraries/Robot_Control/Melody.cpp index 0341c555e..9ef964631 100644 --- a/libraries/Robot_Control/Melody.cpp +++ b/libraries/Robot_Control/Melody.cpp @@ -40,7 +40,7 @@ void RobotControl::playMelody(char* script){ case 'C': playNote(202, time, modifier); break; // Play a C# case 'd': playNote(190, time, modifier); break; // Play a D case 'D': playNote(180, time, modifier); break; // Play a D# - case 'e': playNote(170, time, modifier); break; // Play an F + case 'e': playNote(170, time, modifier); break; // Play an E case 'f': playNote(160, time, modifier); break; // Play an F case 'F': playNote(151, time, modifier); break; // Play an F# case 'g': playNote(143, time, modifier); break; // Play a G @@ -97,4 +97,4 @@ void RobotControl::playFile(char* filename){ void RobotControl::stopPlayFile(){ melody.close(); -} \ No newline at end of file +} From 9ac7e30252fce5b9dafde3288519b020b73c37bd Mon Sep 17 00:00:00 2001 From: Embedded Micro Date: Tue, 10 Jun 2014 08:48:23 -0700 Subject: [PATCH 4/4] Update USBAPI.h Fixes bug where Serial.read() would always return 0 as the first byte. --- hardware/arduino/cores/arduino/USBAPI.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/USBAPI.h b/hardware/arduino/cores/arduino/USBAPI.h index d506b585f..753bc6b20 100644 --- a/hardware/arduino/cores/arduino/USBAPI.h +++ b/hardware/arduino/cores/arduino/USBAPI.h @@ -28,7 +28,7 @@ extern USBDevice_ USBDevice; class Serial_ : public Stream { private: - int peek_buffer; + int peek_buffer = -1; public: void begin(unsigned long); void begin(unsigned long, uint8_t);