Skip to content

Commit

Permalink
Restricted DltFtBuffer to 64bit systems
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianSchmid committed Jun 24, 2024
1 parent 3353c87 commit 8ba64c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ft/dlt_ft_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ impl DltFtBuffer {
}

Check warning on line 262 in src/ft/dlt_ft_buffer.rs

View check run for this annotation

Codecov / codecov/patch

src/ft/dlt_ft_buffer.rs#L262

Added line #L262 was not covered by tests
}

#[cfg(all(feature = "std",test))]
#[cfg(all(feature = "std", test))]
mod test {

use crate::ft::*;
Expand Down
18 changes: 9 additions & 9 deletions src/ft/dlt_ft_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use std::{collections::HashMap, vec::Vec};
/// If you use the [`DltFtPool`] in an untrusted environment an attacker could
/// cause an "out of memory error" by opening up multiple parallel file transfer streams,
/// never ending them and filling them up with as much data as possible.
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
#[cfg(all(feature = "std", target_pointer_width = "64"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", target_pointer_width = "64"))))]
#[derive(Debug, Default, Clone)]
pub struct DltFtPool<ChannelId, Timestamp>
where
Expand All @@ -28,8 +28,8 @@ where
finished: Vec<DltFtBuffer>,
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
#[cfg(all(feature = "std", target_pointer_width = "64"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", target_pointer_width = "64"))))]
impl<ChannelId, Timestamp: Sized> DltFtPool<ChannelId, Timestamp>
where
ChannelId: Hash + Eq + PartialEq + Clone + Sized,
Expand Down Expand Up @@ -163,8 +163,8 @@ where
}

Check warning on line 163 in src/ft/dlt_ft_pool.rs

View check run for this annotation

Codecov / codecov/patch

src/ft/dlt_ft_pool.rs#L160-L163

Added lines #L160 - L163 were not covered by tests
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
#[cfg(all(feature = "std", target_pointer_width = "64"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", target_pointer_width = "64"))))]
impl<ChannelId, Timestamp: Sized> PartialEq for DltFtPool<ChannelId, Timestamp>
where
ChannelId: Hash + Eq + PartialEq + Clone + Sized,
Expand All @@ -175,16 +175,16 @@ where
}
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
#[cfg(all(feature = "std", target_pointer_width = "64"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", target_pointer_width = "64"))))]
impl<ChannelId, Timestamp: Sized> Eq for DltFtPool<ChannelId, Timestamp>
where
ChannelId: Hash + Eq + PartialEq + Clone + Sized,
Timestamp: core::fmt::Debug + Clone + Sized + PartialEq + Eq,
{
}

#[cfg(all(feature = "std", test))]
#[cfg(all(feature = "std", target_pointer_width = "64", test))]
mod tests {
use super::*;
use alloc::format;
Expand Down

0 comments on commit 8ba64c8

Please sign in to comment.