Commit Graph

12803 Commits

Author SHA1 Message Date
Marcus Meissner
2dcd397b46 Merge pull request #1244 from pppanghu77/master
Fixed CHDK Live View Bitmap Desc Memset Target (Copy-Paste Bug)
2026-04-28 10:27:38 +02:00
Liu Jinchang
40cf5c9507 Fixed CHDK Live View Bitmap Desc Memset Target (Copy-Paste Bug)
In chdk_camera_capture_preview(), the memset for bmd was incorrectly
using &vpd as the target, leaving bmd uninitialized with stack garbage.
This is a copy-paste error from the memset line above for vpd.
2026-04-28 10:02:43 +08:00
Marcus Meissner
10953bcb42 Merge pull request #1242 from pppanghu77/master
Fixed CHDK Live View Bitmap Desc Wrong Offset (Copy-Paste Bug)
2026-04-27 11:01:48 +02:00
Liu Jinchang
464b6ce0d5 Fixed CHDK Live View Bitmap Desc Wrong Offset (Copy-Paste Bug)
In ptp_chdk_parse_live_data(), the bitmap framebuffer descriptor (bmd)
was being unpacked using header->vp_desc_start instead of the correct
header->bm_desc_start offset. This is a copy-paste error from the line
above that unpacks the viewport descriptor (vpd).
2026-04-27 13:52:52 +08:00
Marcus Meissner
017be23b45 Merge pull request #1240 from watsonmw/a7r3_fix_timeout
Sony hang fix for pre-2020 cameras
2026-04-24 08:36:06 +02:00
Marcus Meissner
ab37203f62 Apply suggestions from code review
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
2026-04-24 08:35:36 +02:00
Mark Watson
10870c84ca Sony hang fix for pre-2020 cameras
Disable call to ptp_getobjecthandles() with storageid = PTP_HANDLER_SPECIAL
(0xffffffff)

< 2020 cameras hang, > 2020 cameras return PTP_RC_StoreNotAvailable.

From Sony docs:

    2.00 - ptp_getobjecthandles() not documented / not recommended
    3.00 - ptp_getobjecthandles() with 0xffffffff not supported
2026-04-22 08:20:19 -07:00
Marcus Meissner
09f8a940b1 Fixed Sony DPD FormFlag OOB Read (CWE-125) — MEDIUM
ptp_unpack_Sony_DPD() reads the FormFlag byte via dtoh8o(data, *poffset)
without a prior bounds check. The standard ptp_unpack_DPD() at line
686–687 correctly validates *offset + sizeof(uint8_t) > dpdlen before
this same read, but the Sony variant omits this check.

CVE-2026-40339

Reported-By: Sebastián Alba <sebasjosue84@gmail.com>
2026-04-15 11:05:37 +02:00
Marcus Meissner
3b9f9696be Fixed Sony DPD Enum Count OOB Read (CWE-125) — MEDIUM
In the PTP_DPFF_Enumeration case of ptp_unpack_Sony_DPD(), dtoh16o(data, *poffset) reads 2 bytes for enumeration count N without verifying 2 bytes remain. The standard parser at line 704 has this check.

CVE-2026-40338

Reported-By: Sebastián Alba <sebasjosue84@gmail.com>
2026-04-15 11:04:54 +02:00
Marcus Meissner
433bde9888 Fixed UINT128/INT128 Unchecked Offset Advance (CWE-125) — MEDIUM
Finding 5: UINT128/INT128 Unchecked Offset Advance (CWE-125) — MEDIUM

In ptp_unpack_DPV(), the PTP_DTC_UINT128 and PTP_DTC_INT128 cases advance *offset += 16 without verifying 16 bytes remain. The entry check at line 609 only guarantees *offset < total (at least 1 byte available). After the unchecked advance, *offset can exceed total, and the CTVAL macro's bounds check (total - *offset < sizeof(target)) wraps due to unsigned arithmetic.

CVE-2026-40335

Reported-By: Sebastián Alba <sebasjosue84@gmail.com>
2026-04-15 11:04:08 +02:00
Marcus Meissner
259fc7d3bf Fixed Canon FolderEntry Missing Null Termination
ptp_unpack_Canon_FE() copies filename with strncpy into a 13-byte
buffer without explicit null termination. The EOS variant at line
1451–1452 correctly adds fe->Filename[PTP_CANON_FilenameBufferLen-1]
= 0; confirming this was recognized as necessary but not applied to the
original Canon path.

 CVE-2026-40334

Reported-By: Sebastián Alba <sebasjosue84@gmail.com>
2026-04-15 11:03:15 +02:00
Marcus Meissner
7c7f515bc8 Fixed ObjectInfo Parser OOB Read
ptp_unpack_OI() validates len < PTP_oi_SequenceNumber (i.e., len < 48) but then accesses:

    Offsets 48–51: dtoh32a(data + PTP_oi_SequenceNumber) at line 563 (4 bytes OOB)
    Offset 52: data[PTP_oi_filenamelen] at line 547 (5 bytes OOB)
    Offset 56: data[PTP_oi_filenamelen+4] at line 547 (9 bytes OOB)

The Samsung Galaxy 64-bit objectsize detection heuristic reads up to 9 bytes beyond the validated boundary.

 CVE-2026-40340

Reported-By: Sebastián Alba <sebasjosue84@gmail.com>
2026-04-15 11:01:36 +02:00
Marcus Meissner
1817ecead2 Fixed EOS ImageFormat/CustomFuncEx Parsers Lack Length Parameter
ptp_unpack_EOS_ImageFormat() and ptp_unpack_EOS_CustomFuncEx() accept
const unsigned char** data but no length/size parameter. They perform
unbounded reads via dtoh32o calls (up to 36 bytes for ImageFormat,
up to 1024 bytes for CustomFuncEx). Callers in ptp_unpack_EOS_events()
have xsize available but never pass it.

 CVE-2026-40333

Reported-By: Sebastián Alba <sebasjosue84@gmail.com>
2026-04-15 10:59:13 +02:00
Marcus Meissner
c385b34af2 Fixed OOB read in ptp_unpack_EOS_FocusInfoEx
Do not read out values before checking there is sufficient size

CVE-2026-40341
2026-04-15 10:58:06 +02:00
Marcus Meissner
404ff02c75 Fixed Sony DPD Secondary Enum List Memory Leak
Finding 4: Sony DPD Secondary Enum List Memory Leak (CWE-401) — LOW

File: ptp-pack.c:884-885

When processing a secondary enumeration list (2024+ Sony cameras), line
884–885 overwrites dpd->FORM.Enum.SupportedValue with a new calloc()
without freeing the previous allocation from line 857. The original
array and any string values it contains are leaked.

CVE-2026-40336

Reported-By: Sebastián Alba <sebasjosue84@gmail.com>
2026-04-15 10:57:04 +02:00
Marcus Meissner
50a2da6c07 Merge pull request #1234 from watsonmw/sony_mode3_default
Sony: Use mode 3 for all 2020+ Sony cameras
2026-04-09 15:26:29 +02:00
Marcus Meissner
8e95a6cd30 Merge pull request #1237 from watsonmw/sony_a1m2_newprops
Add support for Sony properties:
2026-04-09 15:25:07 +02:00
Mark Watson
66c6347733 - focusindication should be under /status
- Add Dynamic Range Optimizer setting
2026-04-08 21:37:33 -07:00
Mark Watson
b0f87fdfcf Add support for Sony properties:
- silent mode: on/off
- shutter type: electrical / mechanical
- focusindication: unlocked/focused/low contrast etc
- shutterlagtiming: fastest / stable
- focal distance: approx readout of focal distance
2026-04-07 16:54:18 -07:00
Marcus Meissner
ad69533138 Merge pull request #1235 from kraj/kraj/c23
libgphoto2: fix const-correctness for c23 builds
2026-04-07 09:28:50 +02:00
Khem Raj
7cbc8b7241 libgphoto2: fix const-correctness for c23 builds
C23 treats the return values of strrchr() and strchr() as const char *
when the input string is const-qualified. Update local variables to use
const char * where appropriate to avoid discarded-qualifier warnings and
build failures with -std=gnu23.

No functional change intended.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-04-04 15:00:19 -07:00
Mark Watson
c1d16bd786 To support all 2020+ Sony cameras, try to get properties with mode 300 by default.
Check return to see if we got mode 200 properties so we can tell when dealing with older cameras.

Tested with:

- A99V (2012)
- A7R3 (2017)
- Several newer cameras
2026-04-04 09:23:40 -07:00
Marcus Meissner
dc49f1b20f remove quotes to fix meson build 2026-03-30 20:18:15 +02:00
Marcus Meissner
7d655b1e29 add JPEG_SIZE setting to mreson.build 2026-03-30 20:15:18 +02:00
Marcus Meissner
ca4441f481 autoconf checks for the size type of jpeg_mem_dest
fixes https://github.com/gphoto/libgphoto2/pull/1176
2026-03-30 18:00:04 +02:00
Marcus Meissner
48f083ca88 Merge pull request #1233 from gphoto/dependabot/github_actions/github/codeql-action-4.35.1
build(deps): bump github/codeql-action from 4.33.0 to 4.35.1
2026-03-30 16:46:19 +02:00
dependabot[bot]
607b87d4f5 build(deps): bump github/codeql-action from 4.33.0 to 4.35.1
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.33.0 to 4.35.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b1bff81932...c10b8064de)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 14:34:48 +00:00
Marcus Meissner
ff6d87fce0 Merge pull request #1231 from mattjowil/add_DC-G9_bulb_support
Add Bulb support for Panasonic Lumix DC-G9 (possibly for GH5 as well)
2026-03-29 17:41:49 +02:00
Marcus Meissner
4b8f28246f Apply suggestions from code review
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
2026-03-29 17:41:22 +02:00
Marcus Meissner
9ee36b2f07 Update camlibs/ptp2/config.c
Co-authored-by: Hubert Figuière <hub@figuiere.net>
2026-03-29 17:39:50 +02:00
Marcus Meissner
0870477755 Update camlibs/ptp2/config.c
Co-authored-by: Hubert Figuière <hub@figuiere.net>
2026-03-29 17:39:34 +02:00
Marcus Meissner
dd404feccc Update camlibs/ptp2/config.c
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
2026-03-29 17:30:34 +02:00
mattjowil
d52a249743 Cleaned-up comments, language to english 2026-03-28 00:37:29 +01:00
mattjowil
3a8b744318 Added Bulb support for Panasonic Lumix DC-G9 (possibly for GH5 as well) 2026-03-27 22:38:22 +01:00
Marcus Meissner
992d334fb2 Merge pull request #1222 from gphoto/dependabot/github_actions/github/codeql-action-4.33.0
build(deps): bump github/codeql-action from 4.32.6 to 4.33.0
2026-03-21 11:01:10 +01:00
Marcus Meissner
5222027a57 Merge pull request #1228 from rumpuslabs/patch-1
Fix Pentax K1-II USB ID
2026-03-21 11:00:56 +01:00
Tim Bates
d7145f1242 Fix Pentax K1-II USB ID
The Pentax scsi driver requires the camera to be in MSC mode. The K1-II uses different product IDs for MSC and PTP mode, and the wrong USB product ID was copied from the referenced thread.
2026-03-21 12:10:55 +10:30
Marcus Meissner
389683bb34 avoid unbounded strcpy ingto fixed size buffer
fixes https://github.com/gphoto/libgphoto2/issues/1223
2026-03-17 10:11:59 +01:00
Marcus Meissner
71c0ff6545 use snprintf on a fixed size buffer
fixes https://github.com/gphoto/libgphoto2/issues/1224
2026-03-17 09:02:59 +01:00
Marcus Meissner
ed1c766c69 use strncpy to copy in fixed sized buffers
fixes https://github.com/gphoto/libgphoto2/issues/1226
2026-03-17 09:01:32 +01:00
Marcus Meissner
ed34e9e57c Merge pull request #1227 from SPK44/spk44/double_condition_check
Code Review of #1220
2026-03-17 08:46:07 +01:00
Douglas Deslauriers
bee9fb528c Correct same condition, and apply consistently 2026-03-16 18:07:56 -04:00
dependabot[bot]
753fe127e2 build(deps): bump github/codeql-action from 4.32.6 to 4.33.0
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.6 to 4.33.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](0d579ffd05...b1bff81932)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-16 13:39:11 +00:00
Marcus Meissner
07114811b3 Merge pull request #1220 from SPK44/spk44/sony_ptpip_init_close
Sony PTP/IP connection vendor-specific Initialization and De-initialization
2026-03-15 12:48:33 +01:00
Douglas Deslauriers
d4c843068b Add 9281 followup for 9280 commands
These are required, since the camera expects to send something back
after each 9280
2026-03-14 10:55:45 -04:00
Douglas Deslauriers
9c8e469726 Add Sony PTPIP connection init special code 2026-03-14 10:55:45 -04:00
Douglas Deslauriers
6b19c7a228 Synchronize header parameters with source code 2026-03-13 23:56:06 -04:00
Douglas Deslauriers
8515b49d70 Resolve segfault from bad cast
An array type's address is just the address of the first element. The
called function expects it to be a pointer to an array.
2026-03-13 23:55:49 -04:00
Douglas Deslauriers
2132e33a20 Shutdown Sony cameras after PTPIP exits 2026-03-13 23:49:06 -04:00
Marcus Meissner
e26fa28077 Merge pull request #1217 from gphoto/dependabot/github_actions/github/codeql-action-4.32.6
build(deps): bump github/codeql-action from 4.32.5 to 4.32.6
2026-03-10 09:11:17 +01:00