Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
liuq19 committed Jan 24, 2025
1 parent 9bbde4e commit ac82018
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/serde/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1327,12 +1327,12 @@ where
R: Reader<'de>,
T: de::Deserialize<'de>,
{
// check JSON size, because the design of `sonic_rs::Value`, parsing JSON larger than 2 GB is
// check JSON size, because the design of `sonic_rs::Value`, parsing JSON larger than 4 GB is
// not supported
let len = read.as_u8_slice().len();
if len >= (1 << 32) {
return Err(crate::error::make_error(format!(
"Only support JSON less than 2 GB, the input JSON is too large here, len is {len}"
"Only support JSON less than 4 GB, the input JSON is too large here, len is {len}"
)));
}

Expand Down
4 changes: 2 additions & 2 deletions src/value/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub struct Value {
// |str_esc_raw | 6 | *const RawStrHeader (in SharedDom, MUST aligned 8) + *const u8 | |
// | root_node | 7 | *const ShardDom (from Arc, MUST aligned 8) + *const Node (head) | |
//
// NB: we will check the JSON length when parsing, if JSON is > 2GB, will return a error, so we will not check the limits when parsing or using dom.
// NB: we will check the JSON length when parsing, if JSON is >= 4GB, will return a error, so we will not check the limits when parsing or using dom.
#[allow(clippy::box_collection)]
#[repr(C)]
pub(crate) union Data {
Expand Down Expand Up @@ -502,7 +502,7 @@ impl Drop for Value {
Meta::ARR_MUT => ManuallyDrop::drop(&mut self.data.arr_own),
Meta::OBJ_MUT => ManuallyDrop::drop(&mut self.data.obj_own),
Meta::ROOT_NODE => {
let dom = self.meta.unpack_root();
let dom = self.meta.en >= (1 << 32) {();
drop(Arc::from_raw(dom));
}
_ => unreachable!("should not be dropped"),
Expand Down

0 comments on commit ac82018

Please sign in to comment.