Skip to content

Commit

Permalink
[5.2.2] | Fix decrypt failure to drain data (#2618) (#2817)
Browse files Browse the repository at this point in the history
  • Loading branch information
dauinsight authored Aug 26, 2024
1 parent c7de60b commit a985927
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6139,6 +6139,12 @@ internal bool TryReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, int length, T
// call to decrypt column keys has failed. The data wont be decrypted.
// Not setting the value to false, forces the driver to look for column value.
// Packet received from Key Vault will throws invalid token header.
if (stateObj.HasPendingData)
{
// Drain the pending data now if setting the HasPendingData to false.
// SqlDataReader.TryCloseInternal can not drain if HasPendingData = false.
DrainData(stateObj);
}
stateObj.HasPendingData = false;
}
throw SQL.ColumnDecryptionFailed(columnName, null, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6931,6 +6931,12 @@ internal bool TryReadSqlValue(SqlBuffer value,
// call to decrypt column keys has failed. The data wont be decrypted.
// Not setting the value to false, forces the driver to look for column value.
// Packet received from Key Vault will throws invalid token header.
if (stateObj.HasPendingData)
{
// Drain the pending data now if setting the HasPendingData to false.
// SqlDataReader.TryCloseInternal can not drain if HasPendingData = false.
DrainData(stateObj);
}
stateObj.HasPendingData = false;
}
throw SQL.ColumnDecryptionFailed(columnName, null, e);
Expand Down

0 comments on commit a985927

Please sign in to comment.