{"id":"CVE-2023-34454","summary":"snappy-java's Integer Overflow vulnerability in compress leads to DoS","details":"snappy-java is a fast compressor/decompressor for Java. Due to unchecked multiplications, an integer overflow may occur in versions prior to 1.1.10.1, causing an unrecoverable fatal error.\n\nThe function `compress(char[] input)` in the file `Snappy.java` receives an array of characters and compresses it. It does so by multiplying the length by 2 and passing it to the rawCompress` function.\n\nSince the length is not tested, the multiplication by two can cause an integer overflow and become negative. The rawCompress function then uses the received length and passes it to the natively compiled maxCompressedLength function, using the returned value to allocate a byte array.\n\nSince the maxCompressedLength function treats the length as an unsigned integer, it doesn’t care that it is negative, and it returns a valid value, which is casted to a signed integer by the Java engine. If the result is negative, a `java.lang.NegativeArraySizeException` exception will be raised while trying to allocate the array `buf`. On the other side, if the result is positive, the `buf` array will successfully be allocated, but its size might be too small to use for the compression, causing a fatal Access Violation error.\n\nThe same issue exists also when using the `compress` functions that receive double, float, int, long and short, each using a different multiplier that may cause the same issue. The issue most likely won’t occur when using a byte array, since creating a byte array of size 0x80000000 (or any other negative value) is impossible in the first place.\n\nVersion 1.1.10.1 contains a patch for this issue.","aliases":["GHSA-fjpj-2g6w-x25r"],"modified":"2026-08-18T16:55:12.178726Z","published":"2023-06-15T16:27:45.467Z","database_specific":{"cna_assigner":"GitHub_M","cwe_ids":["CWE-190"],"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/34xxx/CVE-2023-34454.json"},"references":[{"type":"WEB","url":"https://github.com/xerial/snappy-java/blob/05c39b2ca9b5b7b39611529cc302d3d796329611/src/main/java/org/xerial/snappy/Snappy.java#L169"},{"type":"WEB","url":"https://github.com/xerial/snappy-java/blob/05c39b2ca9b5b7b39611529cc302d3d796329611/src/main/java/org/xerial/snappy/Snappy.java#L422"},{"type":"WEB","url":"https://github.com/xerial/snappy-java/blob/master/src/main/java/org/xerial/snappy/Snappy.java"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/34xxx/CVE-2023-34454.json"},{"type":"ADVISORY","url":"https://github.com/xerial/snappy-java/security/advisories/GHSA-fjpj-2g6w-x25r"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-34454"},{"type":"FIX","url":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/xerial/snappy-java","events":[{"introduced":"0"},{"fixed":"737f3973ff392c351da2744820a23a0521c6cc77"},{"fixed":"d0042551e4a3509a725038eb9b2ad1f683674d94"}],"database_specific":{"source":["CPE_RANGE","REFERENCES"],"cpe":"cpe:2.3:a:xerial:snappy-java:*:*:*:*:*:*:*:*","extracted_events":[{"introduced":"0"},{"fixed":"1.1.10.1"}]}}],"versions":["v1.1.10.0","v1.1.9.1","v1.1.9.0","1.1.8.4","1.1.8.3","1.1.8.2","1.1.8.1","1.1.8","1.1.7.8","1.1.7.7","1.1.7.6","1.1.7.5","1.1.7.4","1.1.7.3","1.1.7.2","1.1.7.1","1.1.7","1.1.4","1.1.4-M3","1.1.4-M2","1.1.4-M1","1.1.3-M2","1.1.3-M1","1.1.2.5","1.1.0","1.0.5-M4","1.1.0-M3","1.1.0-M1","snappy-java-1.0.4.1","snappy-java-1.0.4","snappy-java-1.0.3.3","snappy-java-1.0.3.2","snappy-java-1.0.3.1","snappy-java-1.0.3","snappy-java-1.0.3-rc4","snappy-java-1.0.3-rc3","snappy-java-1.0.3-rc2","snappy-java-1.0.3-rc1","snappy-java-1.0.1-rc4","snappy-java-1.0.1-rc3","snappy-java-1.0.1-rc2","snappy-java-1.0.1-rc1"],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-34454.json","vanir_signatures_modified":"2026-08-18T16:55:12Z","vanir_signatures":[{"deprecated":false,"digest":{"line_hashes":["60429498577329400835954723277216870771","256070159223810470248444219763910262624","287136198519068600277662868236755322178","274956085062010241958510128479945950687","15011753142896941976200467647648604644","266009674151970729244697737127660122433","331207470830422801069894979267999211182","284917218618121208025823608059698997375","155850013146986049844481716476322442081"],"threshold":0.9},"id":"CVE-2023-34454-1e1689ac","signature_type":"Line","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java"}},{"id":"CVE-2023-34454-202172dd","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94","target":{"file":"src/main/java/org/xerial/snappy/Snappy.java","function":"compress"},"deprecated":false,"digest":{"function_hash":"239337056772190696406541662841341682506","length":102}},{"digest":{"function_hash":"309600479635622944957990371399466035779","length":102},"id":"CVE-2023-34454-393b5517","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94","target":{"file":"src/main/java/org/xerial/snappy/Snappy.java","function":"compress"},"deprecated":false},{"deprecated":false,"digest":{"function_hash":"239337056772190696406541662841341682506","length":102},"id":"CVE-2023-34454-3bca5a5d","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94","target":{"file":"src/main/java/org/xerial/snappy/Snappy.java","function":"compress"}},{"signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94","target":{"file":"src/main/java/org/xerial/snappy/Snappy.java","function":"compress"},"deprecated":false,"digest":{"function_hash":"287770442223686330244832650344404814988","length":102},"id":"CVE-2023-34454-48a0c49d","signature_type":"Function"},{"id":"CVE-2023-34454-592080d3","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java","function":"isTooLargeFloatArrayInputLength"},"deprecated":false,"digest":{"length":108,"function_hash":"305806183518270641982183783563680953015"}},{"digest":{"function_hash":"197601775410030034425030989621733157535","length":108},"id":"CVE-2023-34454-5a878089","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java","function":"isTooLargeShortArrayInputLength"},"deprecated":false},{"source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java","function":"isTooLargeIntArrayInputLengthForBitShuffleShuffle"},"deprecated":false,"digest":{"function_hash":"204471860700078750244256335571282342429","length":112},"id":"CVE-2023-34454-63df3fd6","signature_type":"Function","signature_version":"v1"},{"id":"CVE-2023-34454-6ca58f9e","signature_type":"Line","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java"},"deprecated":false,"digest":{"line_hashes":["261490785213025088667069519084385851285","115180712698337214823336110482447980625","185907569882866238489617931437768938230","22766503012425561424347399626528426951","47398372620838087293680663528119740885","41439093073927938110424749635254633261","241695992710027770388212532187292688290","11246926499948285723754033511824957870","298679599759123174924233449535123759814","45439918193121619900213237061969853886","30339311328546172599591398205177837163","262126763193147493736605011807842713388","60419524623487266613818866035678234667","30814859348266383738399799573203192360","88935231798783490651157935921504198216","263308192564578953736411226870211669888","233941339245417874827491070275106647559","200258048960167040915388793802630733340","183187363726692826116225043875719019933","155944938025986211226064265962161225723","77558098731799044015715635386911215536","232903719964141847364936129034092060485","245807789503580552370905330195606271044","100252214819795669869488265287721696508","37669627717310838818627131730005140703","34001605554692726682637233224876866877","279338451731205710147633082127329874606","321547289523068309104143795617141525205","246719486730118627021880866087983066673","59120396845946570217300674942297236642","62715668921460923325684843237737517265","54094140783130811437880578714274541307","75132167340552452825613793757449311636","117477783293538305630240968745778268154","196355941320863816565027561776687257012","191315562440801440895118284696020563944","180896432979654649654648714006639275164","284569385832404136914000303131363925326","88882916771909372740860740870539163218","32272416715699875947325003550027131795","309227563581567467663266503621092250926","244751548516870372589955283081946241523","9003947851440586996324164925868312933","42565030544582528712807468368939449357","290903690178320527250333709068364564171","284917218618121208025823608059698997375","155850013146986049844481716476322442081"],"threshold":0.9}},{"digest":{"function_hash":"115694192477457560882035332182505764005","length":112},"id":"CVE-2023-34454-6cfba378","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java","function":"isTooLargeLongArrayInputLengthForBitShuffleShuffle"},"deprecated":false},{"id":"CVE-2023-34454-7ccf9ef9","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"function":"isTooLargeDoubleArrayInputLength","file":"src/test/java/org/xerial/snappy/SnappyTest.java"},"deprecated":false,"digest":{"function_hash":"246469542818760304691132520761796565410","length":108}},{"source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"function":"isTooLargeLongArrayInputLength","file":"src/test/java/org/xerial/snappy/SnappyTest.java"},"deprecated":false,"digest":{"function_hash":"246469542818760304691132520761796565410","length":108},"id":"CVE-2023-34454-7dfb9654","signature_type":"Function","signature_version":"v1"},{"signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"function":"isTooLargeDoubleArrayInputLengthForBitShuffleShuffle","file":"src/test/java/org/xerial/snappy/SnappyTest.java"},"deprecated":false,"digest":{"function_hash":"115694192477457560882035332182505764005","length":112},"id":"CVE-2023-34454-87382306","signature_type":"Function"},{"digest":{"function_hash":"204471860700078750244256335571282342429","length":112},"id":"CVE-2023-34454-93cdd4ec","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java","function":"isTooLargeFloatArrayInputLengthForBitShuffleShuffle"},"deprecated":false},{"id":"CVE-2023-34454-9ae7fbe6","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94","target":{"file":"src/main/java/org/xerial/snappy/Snappy.java","function":"compress"},"deprecated":false,"digest":{"function_hash":"309600479635622944957990371399466035779","length":102}},{"deprecated":false,"digest":{"length":108,"function_hash":"305806183518270641982183783563680953015"},"id":"CVE-2023-34454-adcce448","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java","function":"isTooLargeIntArrayInputLength"}},{"deprecated":false,"digest":{"function_hash":"197601775410030034425030989621733157535","length":108},"id":"CVE-2023-34454-dc129d73","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"file":"src/test/java/org/xerial/snappy/SnappyTest.java","function":"isTooLargeCharArrayInputLength"}},{"source":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94","target":{"file":"src/main/java/org/xerial/snappy/Snappy.java","function":"compress"},"deprecated":false,"digest":{"function_hash":"287770442223686330244832650344404814988","length":102},"id":"CVE-2023-34454-e5dba046","signature_type":"Function","signature_version":"v1"},{"signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/d0042551e4a3509a725038eb9b2ad1f683674d94","target":{"file":"src/main/java/org/xerial/snappy/Snappy.java"},"deprecated":false,"digest":{"line_hashes":["146297840328441737710796076324774348109","192658171568027010826956214183428780179","99230512735092722927914337541940380084","131237689999412623311662202288259262252","164938164945917355266720257131197408663","213978049326713919809874311630540082679","201510083685883510031164228398887802166","125532351005332081139379542729920496478","138843753354478491438994609101201565233","70928325793139907639757775025898591297","139253428366467536139167402554400448742","77574394898709015507220099882106655552","145436307643076335473717030842855480357","70928325793139907639757775025898591297","340258145226649637062617952712696153787","48352624152435439668098949145919019718","262458369917213442197181084278786830974","213978049326713919809874311630540082679","307836542362797647162783564479260504653","23402217180879603783392793540294856028","143195951293271588283263923676073433730","192658171568027010826956214183428780179","257869300785618068241603640128398517717","58899204752523462045078928485468279994"],"threshold":0.9},"id":"CVE-2023-34454-e8625863","signature_type":"Line"},{"id":"CVE-2023-34454-f97fdafb","signature_type":"Function","signature_version":"v1","source":"https://github.com/xerial/snappy-java/commit/737f3973ff392c351da2744820a23a0521c6cc77","target":{"function":"isTooLargeShortArrayInputLengthForBitShuffleShuffle","file":"src/test/java/org/xerial/snappy/SnappyTest.java"},"deprecated":false,"digest":{"function_hash":"194152565227331479732749147694718474634","length":112}}]}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H"}]}