mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-28 01:11:23 +01:00
Interfaces, field and method names and descriptors, signatures, constant values, thrown and caught types, inner classes and annotation types each copy their constant-pool text. Many entries can name one 65,535-byte Utf8, so a class file under 100 KiB could make parse() copy gigabytes. parse() now copies at most 64 MiB of such text per class. Past that, names are kept as pool-index placeholders (<class#2>, <utf8#1>) and a warning is added; every row is still listed.
55 lines
1.5 KiB
Rust
55 lines
1.5 KiB
Rust
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
#![forbid(unsafe_code)]
|
|
//! Java class-file inspection and JVM bytecode decoding. Never executes bytecode.
|
|
//! Retains source item, attribute and annotation-depth limits and partial reports.
|
|
mod bytes;
|
|
mod descriptor;
|
|
pub mod java_class;
|
|
pub mod java_ops;
|
|
pub use java_class::*;
|
|
#[cfg(test)]
|
|
mod test_support;
|
|
/// File admission errors; damaged optional structures retain partial-report warnings.
|
|
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
|
pub enum JavaClassError {
|
|
#[error("the file ends early ({0})")]
|
|
Truncated(String),
|
|
#[error("the file is malformed ({0})")]
|
|
Malformed(String),
|
|
#[error("not supported: {0}")]
|
|
Unsupported(String),
|
|
}
|
|
use JavaClassError as FormatError;
|
|
|
|
#[cfg(test)]
|
|
#[path = "regressions/java_array_operands.rs"]
|
|
mod java_array_operands;
|
|
|
|
#[cfg(test)]
|
|
#[path = "regressions/java_attribute_names.rs"]
|
|
mod java_attribute_names;
|
|
|
|
#[cfg(test)]
|
|
#[path = "regressions/java_constant_pool_slots.rs"]
|
|
mod java_constant_pool_slots;
|
|
|
|
#[cfg(test)]
|
|
#[path = "regressions/java_copied_names.rs"]
|
|
mod java_copied_names;
|
|
|
|
#[cfg(test)]
|
|
#[path = "regressions/java_invoke_operands.rs"]
|
|
mod java_invoke_operands;
|
|
|
|
#[cfg(test)]
|
|
#[path = "regressions/java_linkage_references.rs"]
|
|
mod java_linkage_references;
|
|
|
|
#[cfg(test)]
|
|
#[path = "regressions/java_truncated_attributes.rs"]
|
|
mod java_truncated_attributes;
|
|
|
|
#[cfg(test)]
|
|
#[path = "regressions/java_wide_opcodes.rs"]
|
|
mod java_wide_opcodes;
|