Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/control frame payload init crash #716

Merged
merged 3 commits into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ - (instancetype)initWithData:(nullable NSData *)data {

_mtu = SDLControlFrameInt64NotFound;

if (data != nil) {
if (data.length > 0) {
[self sdl_parse:data];
}

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLControlFramePayloadEndService.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ - (instancetype)initWithData:(nullable NSData *)data {

_hashId = SDLControlFrameInt32NotFound;

if (data != nil) {
if (data.length > 0) {
[self sdl_parse:data];
}

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLControlFramePayloadNak.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ - (instancetype)initWithData:(nullable NSData *)data {
self = [super init];
if (!self) return nil;

if (data != nil) {
if (data.length > 0) {
[self sdl_parse:data];
}

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLControlFramePayloadRPCStartService.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ - (instancetype)initWithData:(nullable NSData *)data {
self = [super init];
if (!self) return nil;

if (data != nil) {
if (data.length > 0) {
[self sdl_parse:data];
}

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ - (instancetype)initWithData:(nullable NSData *)data {
_hashId = SDLControlFrameInt32NotFound;
_mtu = SDLControlFrameInt64NotFound;

if (data != nil) {
if (data.length > 0) {
[self sdl_parse:data];
}

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLControlFramePayloadVideoStartService.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (instancetype)initWithData:(nullable NSData *)data {
_height = SDLControlFrameInt32NotFound;
_width = SDLControlFrameInt32NotFound;

if (data != nil) {
if (data.length > 0) {
[self sdl_parse:data];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ - (instancetype)initWithData:(nullable NSData *)data {
_height = SDLControlFrameInt32NotFound;
_width = SDLControlFrameInt32NotFound;

if (data != nil) {
if (data.length > 0) {
[self sdl_parse:data];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,18 @@
});
});

describe(@"Test nil data", ^{
__block SDLControlFramePayloadNak *testPayload = nil;
__block NSData *testData = nil;

beforeEach(^{
testPayload = [[SDLControlFramePayloadNak alloc] initWithData:testData];
});

it(@"should output the correct params", ^{
expect(testPayload.rejectedParams).to(beNil());
});
});


QuickSpecEnd
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,17 @@
});
});

describe(@"Test nil data", ^{
__block SDLControlFramePayloadVideoStartService *testPayload = nil;
__block NSData *testData = nil;

beforeEach(^{
testPayload = [[SDLControlFramePayloadVideoStartService alloc] initWithData:testData];
});

it(@"should output the correct params", ^{
expect(testPayload.data.length).to(equal(0));
});
});

QuickSpecEnd
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,17 @@
});
});

describe(@"Test nil data", ^{
__block SDLControlFramePayloadVideoStartServiceAck *testPayload = nil;
__block NSData *testData = nil;

beforeEach(^{
testPayload = [[SDLControlFramePayloadVideoStartServiceAck alloc] initWithData:testData];
});

it(@"should output the correct params", ^{
expect(testPayload.data.length).to(equal(0));
});
});

QuickSpecEnd
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,18 @@
});
});

describe(@"Test nil data", ^{
__block SDLControlFramePayloadAudioStartServiceAck *testPayload = nil;
__block NSData *testData = nil;

beforeEach(^{
testPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithData:testData];
});

it(@"should output the correct params", ^{
expect(testPayload.mtu).to(equal(-1));
expect(testPayload.data.length).to(equal(0));
});
});

QuickSpecEnd
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,18 @@
});
});

describe(@"Test nil data", ^{
__block SDLControlFramePayloadEndService *testPayload = nil;
__block NSData *testData = nil;

beforeEach(^{
testPayload = [[SDLControlFramePayloadEndService alloc] initWithData:testData];
});

it(@"should output the correct params", ^{
expect(testPayload.hashId).to(equal(-1));
expect(testPayload.data.length).to(equal(0));
});
});

QuickSpecEnd
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,17 @@
});
});

describe(@"Test nil data", ^{
__block SDLControlFramePayloadRPCStartServiceAck *testPayload = nil;
__block NSData *testData = nil;

beforeEach(^{
testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:testData];
});

it(@"should output the correct params", ^{
expect(testPayload.data.length).to(equal(0));
});
});

QuickSpecEnd
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,18 @@
});
});

describe(@"Test nil data", ^{
__block SDLControlFramePayloadRPCStartService *testPayload = nil;
__block NSData *testData = nil;

beforeEach(^{
testPayload = [[SDLControlFramePayloadRPCStartService alloc] initWithData:testData];
});

it(@"should output the correct params", ^{
expect(testPayload.protocolVersion).to(beNil());
expect(testPayload.data.length).to(equal(0));
});
});

QuickSpecEnd