Skip to content

Commit

Permalink
fix - reg - Fixed photo, logo, and sound parsing
Browse files Browse the repository at this point in the history
We've fixed a regression where we would crash immediately for vCard 3.0 and 4.0

---

We've fixed a regression where we would crash immediately for vCard 3.0 and 4.0 parsers when they encounter either the photo, the logo, or the sound property.

---

Type: fix
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Oct 1, 2023
1 parent 4f0cea9 commit 61204eb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VisualCard/Converters/AndroidContactsDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ ORDER BY
photoBlock.Append("\n ");
}
}
masterContactBuilder.AppendLine($"{_photoSpecifierWithType}ENCODING=BLOB;JPEG:{photoBlock}");
masterContactBuilder.AppendLine($"{_photoSpecifierWithType}ENCODING=BLOB;TYPE=JPEG:{photoBlock}");
break;
}

Expand Down
4 changes: 2 additions & 2 deletions VisualCard/Parts/LogoInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ internal static LogoInfo FromStringVcardThreeWithType(string value, StreamReader
// Get the value
string logoValue = value.Substring(VcardConstants._logoSpecifier.Length + 1);
string[] splitLogo = logoValue.Split(VcardConstants._argumentDelimiter);
if (splitLogo.Length >= 2)
if (splitLogo.Length < 2)
throw new InvalidDataException("Logo field must specify exactly two values (Type and arguments, and logo information)");

// Check to see if the value is prepended by the VALUE= argument
Expand Down Expand Up @@ -260,7 +260,7 @@ internal static LogoInfo FromStringVcardFourWithType(string value, List<string>
// Get the value
string logoValue = value.Substring(VcardConstants._logoSpecifier.Length + 1);
string[] splitLogo = logoValue.Split(VcardConstants._argumentDelimiter);
if (splitLogo.Length >= 2)
if (splitLogo.Length < 2)
throw new InvalidDataException("Logo field must specify exactly two values (Type and arguments, and logo information)");

// Check to see if the value is prepended by the VALUE= argument
Expand Down
4 changes: 2 additions & 2 deletions VisualCard/Parts/PhotoInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ internal static PhotoInfo FromStringVcardThreeWithType(string value, StreamReade
// Get the value
string photoValue = value.Substring(VcardConstants._photoSpecifier.Length + 1);
string[] splitPhoto = photoValue.Split(VcardConstants._argumentDelimiter);
if (splitPhoto.Length >= 2)
if (splitPhoto.Length < 2)
throw new InvalidDataException("Photo field must specify exactly two values (Type and arguments, and photo information)");

// Check to see if the value is prepended by the VALUE= argument
Expand Down Expand Up @@ -260,7 +260,7 @@ internal static PhotoInfo FromStringVcardFourWithType(string value, List<string>
// Get the value
string photoValue = value.Substring(VcardConstants._photoSpecifier.Length + 1);
string[] splitPhoto = photoValue.Split(VcardConstants._argumentDelimiter);
if (splitPhoto.Length >= 2)
if (splitPhoto.Length < 2)
throw new InvalidDataException("Photo field must specify exactly two values (Type and arguments, and photo information)");

// Check to see if the value is prepended by the VALUE= argument
Expand Down
4 changes: 2 additions & 2 deletions VisualCard/Parts/SoundInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ internal static SoundInfo FromStringVcardThreeWithType(string value, StreamReade
// Get the value
string soundValue = value.Substring(VcardConstants._soundSpecifier.Length + 1);
string[] splitSound = soundValue.Split(VcardConstants._argumentDelimiter);
if (splitSound.Length >= 2)
if (splitSound.Length < 2)
throw new InvalidDataException("Sound field must specify exactly two values (Type and arguments, and sound information)");

// Check to see if the value is prepended by the VALUE= argument
Expand Down Expand Up @@ -260,7 +260,7 @@ internal static SoundInfo FromStringVcardFourWithType(string value, List<string>
// Get the value
string soundValue = value.Substring(VcardConstants._soundSpecifier.Length + 1);
string[] splitSound = soundValue.Split(VcardConstants._argumentDelimiter);
if (splitSound.Length >= 2)
if (splitSound.Length < 2)
throw new InvalidDataException("Sound field must specify exactly two values (Type and arguments, and sound information)");

// Check to see if the value is prepended by the VALUE= argument
Expand Down

0 comments on commit 61204eb

Please sign in to comment.