enable new builtins (*with gotcha)
We still need to adjust the writeBits one to work around its list<int> argument.
This commit is contained in:
@@ -136,6 +136,8 @@ pub enum Error {
|
||||
ReadBitOutOfBounds,
|
||||
#[error("writeBits: index out of bounds")]
|
||||
WriteBitsOutOfBounds,
|
||||
#[error("illegal operation on empty ByteArray")]
|
||||
EmptyByteArray,
|
||||
#[error("blst error {0:?}")]
|
||||
Blst(blst::BLST_ERROR),
|
||||
#[error("blst::hashToGroup")]
|
||||
|
||||
@@ -1592,6 +1592,10 @@ impl DefaultFunction {
|
||||
let bytes = args[0].unwrap_byte_string()?;
|
||||
let bit_index = args[1].unwrap_integer()?;
|
||||
|
||||
if bytes.is_empty() {
|
||||
return Err(Error::EmptyByteArray);
|
||||
}
|
||||
|
||||
// This ensures there is at least one byte in bytes
|
||||
if *bit_index < 0.into() || *bit_index >= (bytes.len() * 8).into() {
|
||||
return Err(Error::ReadBitOutOfBounds);
|
||||
|
||||
Reference in New Issue
Block a user